Hi, In oreder to improve the performance of my applet I want to download the images as a jar file (say images.jar). But when I tried to read the images from this jar file I am getting an exception like this. java.util.zip.ZipException: No such file or directory at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:112) at java.util.jar.JarFile.<init>(JarFile.java:127) at java.util.jar.JarFile.<init>(JarFile.java:65)
Here is few lines from my code which is trying to extract images from the jar.
JarFile jarfile = new JarFile("images.jar");
ZipEntry firstentry = jarfile.getEntry("images/xyz.gif"); int size= (int) firstentry.getSize(); ... ... The exception is thrown from the first line ( "JarFile jarfile = new JarFile("images.jar")").
In the archive attribute of my applet tag I am adding this jar file also..
The JarFile constructor takes the name of a local file. This fails, of course, because your jar file is back on the server. You may be able to load the images individually through Class.getResourceAsStream() since the jar is in the classpath (well, ARCHIVE parameter). If that doesn't work you will have to create a URL back to the JAR file and use JarInputStream to load it.