This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to include PNG in Eclipse export?" Watch "How to include PNG in Eclipse export?" New topic

How to include PNG in Eclipse export?

Ravi Shankarappa
Ranch Hand

Joined: Jan 09, 2010
Posts: 55

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.

James E Baker

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
It is sorta covered in the JavaRanch Style Guide.
subject: How to include PNG in Eclipse export?