I have a Java Applet that needs a 3rd party library, but how do I add the jar to the classpath and reference it to the Java Applet?
My third party library is org.apa
Do you want to embed your applet into a website / HTML with the applet tag?
<applet code="de.package.AppletClass"
archive="apache-commons-lang.jar">
</applet>
Deploying With the Applet Tag
To compile it in console use:
javac -classpath C:\dev\YourClass.java C:\dev\3thParty.jar
Compiling the Example Programs
Put the other jars in the Class-Path
property in the manifest.mf and
build an index to the other jars so that the loader won't have to download
a jar unless it really needs it.
Alternatively, you can mention the jars in the archive tag.
In archive tag you can add multiple jars: archive="MyJar.jar,JarFile1.jar,JarFile2.jar"
So your archive attribute will be like this archive="YourProject.jar,commons-lang-2.1.jar"
(Remember that you have to put commons-lang-2.1.jar with YourProject.jar in the same dir on your server.)