aspose file tools*
The moose likes Applets and the fly likes jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "jar file" Watch "jar file" New topic
Author

jar file

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
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
Karan V Praba
Ranch Hand

Joined: Oct 31, 2002
Posts: 41
Hai,
U need to give Class-Path:B.jar in manifest file of A.jar. And try it out.Location of B.jar is relative path of A.jar.


Karan V Praba.
Karan V Praba
Ranch Hand

Joined: Oct 31, 2002
Posts: 41
Don't add B.jar into A.jar.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

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.
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Karan and Avi thanks for reply.
Garandi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar file