Creating the Java ARchive (JAR) file

Whenever you compile the unmodified applets samples, modify and rename the applets, or customize the samples, or create your own Java applets or applications, you must create a Java Archive (JAR) file to contain the compiled classes for deployment. (See Sun Microsystems JDK documentation for information on using the Java Archive tool.)

Note The following procedure assumes you have already compiled the samples without compiler errors (for information, see Compiling the Application/Applet).

To create a JAR file, for example for the sample Java Step Processor, use the following procedure:

  1. Open a command prompt, and cd to the parent directory of the directory containing your application/applet; for example for the Step Processor sample, cd to the parent ...\Developer Files directory).
  2. Create a JAR file containing only the compiled classes (and related information class and image files) by entering a command similar to the following (modify for the appropriate JDK, images, etc.):

    C:\jdk1.4.0\bin\jar.exe -cvf sample.jar samples\vwpanel\samplestep\*.class samples\vwpanel\samplestep\resources\*.class samples\vwpanel\samplestep\images\*.class samples\vwpanel\samplestep\images\*.gif

    You should receive output similar to the following:

    added manifest
    adding: samplestep\VWSampleStepApplet.class(in = 2617) (out= 1297)(deflated 50%)
    adding: samplestep\VWSampleStepApplication.class(in = 3090) (out= 1542)(deflated 50%)
    adding: samplestep\VWSampleStepPanel.class(in = 4222) (out= 2053)(deflated 51%)
    adding: samplestep\resources/VWResource.class(in = 437) (out= 299)(deflated 31%)
    adding: samplestep\images/VWImageLoader.class(in = 1239) (out= 602)(deflated 51%)
    adding: samplestep\images/icon.gif(in = 1432) (out= 1015)(deflated 29%)
    adding: samplestep\images/step.gif(in = 1592) (out= 1260)(deflated 20%)

  3. Once the classes have been added to the JAR file, deploy the JAR file as follows:

Note You must sign the JAR file (using the Netscape Object Signing Certificate).

If you intend to use several JAR files, you should add all of the compiled files into a single JAR file and deploy just that one file. Alternatively, you can specify multiple JAR files using a comma (",") delimiter (however, be aware that not all browsers support multiple JAR files). If you plan to use several JAR files, you should place each JAR file in the same directory as the JSP or other file that contains the applet.