GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes How to include PNG in Eclipse export? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to include PNG in Eclipse export?" Watch "How to include PNG in Eclipse export?" New topic
Author

How to include PNG in Eclipse export?

Ravi Shankarappa
Ranch Hand

Joined: Jan 09, 2010
Posts: 55
Hello,

I load a .png file and display it in a JPanel when my program (see below) starts.


When I run it within eclipse the png is displayed correctly. However, when I export my program and run the executable jar file it doesn't. How do I include the .png file in my jar file?

I had posted the question in Eclipse forum but got no answer, so please help me.

-Ravi
James E Baker
Greenhorn

Joined: Jul 28, 2011
Posts: 23
Silly question, but mySplash.png is inside your jar file, correct?
Jon Avadis
Ranch Hand

Joined: Jul 20, 2011
Posts: 49

My guess would be that your programm is just loading the png from where it is, but the png-file itself is not included in your project/jar.
In Eclipse you can just drag and drop the file into your projectfolder and eclipse will ask you, if you want to copy and safe it inside your project.

Knowledge Reigns Supreme
 
GeeCON Prague 2014
 
subject: How to include PNG in Eclipse export?