aspose file tools
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


Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
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: 182

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
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image inside jar file