• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to include PNG in Eclipse export?  RSS feed

 
Ravi Shankarappa
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly question, but mySplash.png is inside your jar file, correct?
 
Jon Avadis
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!