• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image inside jar file

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

I have to display some icons in the GUI which i create. I have included the following gif files in the code:



I created a seperate icon package and copied all those images inside this package.
When i create an executable jar and run it, these icon images are not getting displayed in the interface.

Kindly provide your help in resolving this problem.

Regards,
Vijay
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ImageIcon(String) constructor expects a file name as parameter, so that won't work. Something like the following should do the trick:

You may have to fiddle around with the path name, and whether or not there needs to be a slash in front of it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic