I went through the JAR specification document and found that an in-memory hashtable is created using INDEX.LST file to speed up the class file look up process.
If any one can answer my following questions -
1. When is the hashtable constructed? When the application loads or when the request comes for loading the applet?
2. Since all the classes are already part of the archive, why should one get InvalidJarIndexException. How can indexes become invalid? e.g. In my case I get InvalidJarIndexException when I use index=true along with indexjars in my ant build but I do not see any exceptions when indexjars are not used.
3. How should I go about resolving the InvalidJarIndexException if I want to stick with indexing?
4.Role of java browser plugin in downloading jar files?
Say we have two jar files a.jar and b.jar
1. a.jar is created first
2. b.jar is created with index=true and a.jar as the indexjar
Do you mean b.jar needs to be re-indexed in any case either of the jar files are updated.
How does the applet loader knows that the indexes needs to be updated as I do not see any other file besides the INDEX.LST inside the jar file which is a plain text file
I created a sample application to create InvalidJarIndexException but failed to do so
My application consists of an applet which loads three jar files a.jar, b.jar and c.jar. The c.jar being an indexed jar referring to a.jar and b.jar in its pathelement.
I tested by updating each of the jars one by one and deploying the web application. Every time the applet is loading successfully and I did not observe InvalidJarIndexException. The sample application is very very small compared to the application I am working on.
Why is not applet loader complaining in this case. The behavior seems to be inconsistent to me.
I am not sure exactly what invalidates the index. The operation I did to update the jar includes
C.jar is a jar which has the index.lst file composed of packages from A.jar and B.jar
After I built C.jar using A.jar and B.jar, I signed B.jar to add certificates in the jar and packed the web application. I guess this should have invalidated the indexes.
The InvalidJarIndexException appears in the java console when the applet loading starts. http://www.kiwidoc.com/java/l/p/java/j2se/1.6/p/sun.misc/c/InvalidJarIndexException