This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: ImageIcon's not displayed when created a executable Jar.
 
Similar Threads
Image inside jar file
Problems loading images from application JAR
Folder icon display at richfaces tree node
change jar file's icon
How do I display an image on a JLabel