Re: loading files from a jar



On Thu, 27 Oct 2005 11:10:23 -0400, frank <fgeck@xxxxxxxxxxxxx> wrote,
quoted or indirectly quoted someone who said :

>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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.



Relevant Pages

  • Re: steam url out to a client
    ... I am all ready fetching files from the local file system using ... My problems come when the file I want to return is not the local file ... Marc's suggestion about downloading large files in chunks seems ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: web start
    ... The codebase is an important aspect of any ... local file system. ... So I think it is expecting the jar archive to ...
    (comp.lang.java.programmer)
  • Re: Switch from /var/mail/username to IMAP and how to move folders
    ... directory on the local file system and I keep a ... If I go with IMAP, is it correct that I can choose ... whether to keep my mail folders on the local file system (i.e. like ... now) or to have them on the IMAP server? ...
    (comp.mail.mutt)
  • Re: Switch from /var/mail/username to IMAP and how to move folders
    ... directory on the local file system and I keep a ... If I go with IMAP, is it correct that I can choose ... whether to keep my mail folders on the local file system (i.e. like ... now) or to have them on the IMAP server? ...
    (comp.mail.mutt)
  • Switch from /var/mail/username to IMAP and how to move folders
    ... directory on the local file system and I keep a ... whether to keep my mail folders on the local file system (i.e. like ... now) or to have them on the IMAP server? ...
    (comp.mail.mutt)