File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Cant load images from my jar" Watch "Cant load images from my jar" New topic

Cant load images from my jar

Yaroslav Chinskiy
Ranch Hand

Joined: Jan 09, 2001
Posts: 147

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.

I agree. Here's the link:
subject: Cant load images from my jar
It's not a secret anymore!