File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Generat JAR file with resouces such as picture and music! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Generat JAR file with resouces such as picture and music!" Watch "Generat JAR file with resouces such as picture and music!" New topic
Author

Generat JAR file with resouces such as picture and music!

magic zha
Greenhorn

Joined: Mar 25, 2005
Posts: 24
I have such program:

I have generate the jar file by command:
jar cvfm Test.jar mymanifest.mf TestPanel.class
when I double click it,the programe worked and the picture displayed.
But when move the jar file to other place,why dosen't the picture display?
Please help me ,thank you!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try it like this, if it still doesn't display - check the capitalisation
of the image fileName

magic zha
Greenhorn

Joined: Mar 25, 2005
Posts: 24
I have tried , but still failed.
The programe always display a dialog which indicates the URL=null,and can't display the image.
I use the command:
jar cvfm ImageInJar.jar manifest.mf ImageInJar.class ImagePanel.class TEST.gif
magic zha
Greenhorn

Joined: Mar 25, 2005
Posts: 24
I have tried , but still failed.
The programe always display a dialog which indicates the URL=null,and can't display the image.
I use the command:
jar cvfm ImageInJar.jar manifest.mf ImageInJar.class ImagePanel.class TEST.gif
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Your code looks like it is looking for TEST.GIF and your jar command used TEST.gif (upper/lower case difference).

Otherwise it looks like it should work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generat JAR file with resouces such as picture and music!