Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

loading files from a jar

Thread view: 
frank - 27 Oct 2005 16:10 GMT
Had something working just fine when the files where on the local file
system but now that I have them in a jar it's not working.  I believe
the paths are correct just seems to be going to the local file system
and not the jar file.

String styleSheet = xss/style.xsl

    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(
        styleSheet));

Thanks,

Frank
Roedy Green - 31 Oct 2005 11:19 GMT
>Had something working just fine when the files where on the local file
>system but now that I have them in a jar it's not working.  I believe
>the paths are correct just seems to be going to the local file system
>and not the jar file.

It is behaving as advertised.

you are doing effectively
new StreamSource( "xss/style.xsl" );

StreamSource is expecting an URL, e.g. the result of a getResource.

You gave it a relative URL which I presume it is interpreting as:

 file:xxx/style.xsl

a file in the CWD of the local file system, not a resource.

Try feeding the rnesult of a getResourceAsStream(" xss/style.xsl" );
instead where that file is stored under the current package name in
the jar.

http://mindprod.com/jgloss/image.html

and
http://mindprod.com/jgloss/resource.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.