File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Cant load images from my jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Cant load images from my jar" Watch "Cant load images from my jar" New topic
Author

Cant load images from my jar

Yaroslav Chinskiy
Ranch Hand

Joined: Jan 09, 2001
Posts: 147
Hey,

I have images stored in one of the packages.

i run a sample app that has to load a splash screen.
the app is in com.bla.tst package, the images are in com.bla.images
i can never resolve URL to load them:




Pleas advice.
Thank you
clio katz
Ranch Hand

Joined: Apr 30, 2004
Posts: 101
Hi Yaroslav,

Looks like you have your packages all jar'red-up (correct me if i'm wrong).

There are several ways to get at the images. I usually create a single 'images' directory in the jar, but if you need multiple dirs ... no problem.

Here are some programming notes i made for myself some time ago:



Regarding the path, if you are loading from the JAR, you can use the relative path eg.


hth!
 
wood burning stoves
 
subject: Cant load images from my jar