Access images from jar
Posted on 2000-01-20
I am writing an applet using JDK1.2 and found problem in accessing the images from the jar archives.
My program behaves normally without using jar. If using jar, all functions behave normally except displaying images.
How can I solve this problem?
Here are the details of my program:
The directory structure of my files like this:
I use this command to create the archives:
jar cvf all.jar *.class .\images\
I use this to extract the files and found that the result directory structure is the same as I have described.
jar xf all.jar
In my program, i use this to get the image.
Image image = applet.getImage(getDocumentBase(), "./images/" + imageName);
My html files contain this:
<APPLET CODE=Applet.class ARCHIVE=all.jar WIDTH=600 HEIGHT=400></APPLET>