Applet with multiple jars

Discussion in 'Java' started by gpl@fishcroft.ca, Apr 25, 2005.

  1. Guest

    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
    , Apr 25, 2005
    #1
    1. Advertising

  2. Nigel Wade Guest

    wrote:

    > 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
    >


    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.

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
    Nigel Wade, Apr 25, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dirk Reiss
    Replies:
    0
    Views:
    1,142
    Dirk Reiss
    Oct 8, 2003
  2. Ike
    Replies:
    6
    Views:
    1,050
    Andrew Thompson
    Sep 24, 2004
  3. Replies:
    5
    Views:
    9,023
  4. JavaEnquirer
    Replies:
    2
    Views:
    513
    JavaEnquirer
    Feb 22, 2006
  5. Ulf Meinhardt
    Replies:
    2
    Views:
    1,401
Loading...

Share This Page