Applet with multiple jars

G

gpl

I have an applet that requires jmf.jar, however this jar file may not
be on the client site. I have done some looking but am unable to come
up with a solution that allows me to sucessfully send this jar along
with the jar containing the applet code to the client site. Any help
will be greatly apreciated., especially if you have a "working"
solution and not just a documentation reference.

Robert
(e-mail address removed)
 
N

Nigel Wade

I have an applet that requires jmf.jar, however this jar file may not
be on the client site. I have done some looking but am unable to come
up with a solution that allows me to sucessfully send this jar along
with the jar containing the applet code to the client site. Any help
will be greatly apreciated., especially if you have a "working"
solution and not just a documentation reference.

Robert
(e-mail address removed)

You need to add this jar to the classpath in the manifest of the jar file
which is downloaded. If you do this then the applet classloader will
download that jar from the codebase specified. So, you need to add a
Class-Path: directive into the jar's manifest, and also make sure that the
additional jar is in the correct location on the server.

For example, I have a jar realTimeApplet.jar which requires several other
jars to operate. This is the applet tag in the html page:

<applet code="realTimeApplet/StartUp.class"
codebase="http://www.ion.le.ac.uk:8080/java/lib"
archive="realTimeApplet.jar" width="100" height="100">

(the reason I use port 8080 is that the applet talks to a servlet handled by
Tomcat, I only want one copy of the jars so use Tomcat to serve them rather
than Apache).

The manifest for realTimeApplet.jar is:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)
Class-Path: coords.jar fitData.jar fanWindow.jar timeWindow.jar dataSe
rvlet.jar colour.jar numbers.jar worldMap.jar


which is created by ant, with the following directives:

<property name="otherJars" value="coords.jar fitData.jar fanWindow.jar
timeWindow.jar dataServlet.jar colour.jar numbers.jar worldMap.jar"/>

<target name="jar" depends="compile" description="Create project jar file">
<jar jarfile="${jar.dir}/${jarfile}" basedir="${bin.dir}">
<manifest>
<attribute name="Class-Path" value="${otherJars}"/>
</manifest>
</jar>
</target>

All the jars are in the same directory on the Tomcat server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top