This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes  ImageIcon's not displayed when created a executable Jar. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " ImageIcon Watch " ImageIcon New topic
Author

ImageIcon's not displayed when created a executable Jar.

Pradeep Kumar Singh
Greenhorn

Joined: Jan 03, 2011
Posts: 2
I have created a Java Swing application with an Icon Image and executed in Eclipse it's showing Icon Image but when I exported this application as a Runnable JAR then application is working fine but Icon Image is not displayed.
I am struggling ... could you please let me know the problem?

Regards...
Stanislav Lapitsky
Ranch Hand

Joined: Dec 01, 2009
Posts: 53
How do you create the icon? Guess from a file. But if you pack all the classes and resources in a jar file you can't acess image file.
Try to use

and then create image from the stream.
Pradeep Kumar Singh
Greenhorn

Joined: Jan 03, 2011
Posts: 2
Stanislav Lapitsky wrote:How do you create the icon? Guess from a file. But if you pack all the classes and resources in a jar file you can't acess image file.
Try to use

and then create image from the stream.


Yes.. I was doing the way you guessed..
now its done. thanks for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ImageIcon's not displayed when created a executable Jar.
 
Similar Threads
How do I display an image on a JLabel
change jar file's icon
Folder icon display at richfaces tree node
Image inside jar file
Problems loading images from application JAR