Link to home
Start Free TrialLog in
Avatar of agnesko
agnesko

asked on

Access images from jar

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:
\*.class
\images\*.jpg

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>


Avatar of agnesko
agnesko

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of sen_kum
sen_kum

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial