aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Images in  a Jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Images in  a Jar File" Watch "Images in  a Jar File" New topic
Author

Images in a Jar File

wasif akbar
Greenhorn

Joined: May 02, 2001
Posts: 11
Using Forte for development. In my gui I use getImage("com/teoco/EitParser/eplogo.gif") to load the image in my title bar rather than the Java logo. This works.
Now I create a jar of all of the class files and this logo. Then I create a cmd file that launches the gui, but the image doesn't appear in the title bar anymore. After creating the bar, the gui can't seem to find the gif. Any ideas as to why???
Thanks in advance.
Jahanzeb Sayal
Greenhorn

Joined: Mar 02, 2001
Posts: 21
I also have a same problem but the image is not on the on the title bar but used as splash screen. But if i provide the image in the correcct path outside the jar file it works perfectly.
What can i say is that it is due to the slow loading of images?
Anyone else with a better answer will be welcomed....
Jahanzeb Sayal


Sayal
Swamy Vatti
Ranch Hand

Joined: May 02, 2001
Posts: 57
Keep the jar file in the classpath and try this code

frame.setIcon(new ImageIcon(getClass().getResource("/dir1/dir2/gif.gif"))
hope this works


Swamy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Images in a Jar File