Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

the pictures are not loaded into an executable jar file

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need some help.
I created an simple application, where fish objects swim randomly in a frame. this application consists of 2 classes (Aquarium.class and Fish.class)and 3 image files (.png files).

when I created an executable JAR file without including the image files, with the command statement below.
jar cmf mainClass.txt TheQuarium.jar *.class *.png
I could run the executable JAR file IN the directory where the image files reside.

but when I created another executable JAR file , this time, including the images with the command below.

jar cmf mainClass.txt TheQuarium2.jar *.class *.png


however, the application wouldn't load the image files when it comes to running the application in any directory outside the directory where all the .class and .png files reside.

can anyone suggest me to solve this problem.

thank you
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming the images are really included in the jar file, did you try using getResource?



See Loading Images Using getResource
http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic