This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Executable jar - including image files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Executable jar - including image files" Watch "Executable jar - including image files" New topic
Author

Executable jar - including image files

Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Hi guys,
have just created executable jar for a small test app which includes a jpeg that is drawn on a JPanel somewhere in the program. Problem is when I double click the jar the image is not appearing.
Is there any special way I need to add resources such as image files to a jar, or a special way to reference them in the app code? I assumed I could just include the jpeg in the jar and it would work, but apparently not.


SCJP 1.4, www.gsi3d.org.uk
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Is there any special way I need to add resources such as image files to a jar, or a special way to reference them in the app code?
Try this:
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Thanks Eugene, that worked
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Executable jar - including image files