I build a jar file called "A.jar", to invoke my applet from. In one of ".class" file, I have imported a class which is in a jar file say "B.jar", if I include B.jar in A.jar the class which uses the class which is in B.jar throws an exception cannot find the class. I am new to applet any help is welcome. Thank you Garandi
Hi Garandi, Although you can nest JAR files (i.e. package one JAR file inside another), java doesn't know how to handle nested JAR files (as you have seen ;-) In order to overcome your problem, you have several options -- one of which has already been mentioned by Karan (namely, using the "Class-Path:" header of the JAR manifest file). Another option would be to build a new JAR file that contains all the classes from "A.jar" and "B.jar" (if that's feasible for you). Note that the <APPLET> tag has an ARCHIVE attribute that can take a list of JAR files. Here is a quote from the relevant javadoc: http://java.sun.com/j2se/1.4.1/docs/guide/misc/applet.html
ARCHIVE = archiveList This OPTIONAL attribute describes one or more archives containing classes and other resources that will be "preloaded". The classes are loaded using an instance of an AppletClassLoader with the given CODEBASE. The archives in archiveList are separated by ",".
So you could list both "A.jar" and "B.jar" in your archive list. Hope this has helped you. Good Luck, Avi.