wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Image inside jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image inside jar file" Watch "Image inside jar file" New topic
Author

Image inside jar file

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear friends,

I have to display some icons in the GUI which i create. I have included the following gif files in the code:



I created a seperate icon package and copied all those images inside this package.
When i create an executable jar and run it, these icon images are not getting displayed in the interface.

Kindly provide your help in resolving this problem.

Regards,
Vijay
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41113
    
  45
The ImageIcon(String) constructor expects a file name as parameter, so that won't work. Something like the following should do the trick:

You may have to fiddle around with the path name, and whether or not there needs to be a slash in front of it.


Ping & DNS - my free Android networking tools app
 
 
subject: Image inside jar file
 
Similar Threads
adding .jpg file to a jar file
Where to store image files?
Is it okay to use images found on the web?
Problems loading images from application JAR
Accessing jar file contents