File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Applet .jar files and libraries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet .jar files and libraries" Watch "Applet .jar files and libraries" New topic

Applet .jar files and libraries

J Ellis

Joined: Aug 23, 2009
Posts: 28
I am having a heck of a time getting my applet to be able to read its required libraries. I have seen threads here and there on this issue, but have not been able to find straightforward language on what is required. My situation is as follows:

I have an applet that uses the Java Advanced Imaging API and thus needs to read in classes from jai_codec.jar and jai_core.jar, among others. The Applet itself must be able to load files from the local server and therefore it must (as far as I understand) be archived in a signed .jar file (please correct me if I'm wrong on this). The problem is that the applet cannot find the other .jar files it needs to read from.

Now, I have seen some indication that perhaps these libraries must be included in the 'archive' attribute in the Applet tag. I have not tried this yet, but this solution does not appeal to me since the libraries required by the Applet may be quite numerous. I have tried simply dropping the external .jar file into the same directory as the Applet's .jar file, and also including them in the root directory of the Applet's .jar file, to no avail.

I would like to know if adding these libraries to the 'archive' attribute is the only way (and/or the preferred way) to accomplish what I am trying to do, or if there is some other way to load these libraries so that the Applet can find them.

Thank you,

Justin Ellis
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Adding them to the archive attribute is the only way. Note that they also *may* need to be signed; I'm not quite sure on that.
J Ellis

Joined: Aug 23, 2009
Posts: 28

Thank you so much for the quick and succinct reply. I can verify that I did not have to sign the library .jar files.

Justin Ellis
I agree. Here's the link:
subject: Applet .jar files and libraries
It's not a secret anymore!