Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

Introduction to Java Programming

CSCI2133

3 credits

2011Fall

08.16.10 - 12.12.10

Introduction to Java Programming

CSCI2133

Monday Wednesday
04:00 PM - 05:20 PM

Create a JAR file for a Java Applet

How To

Create the JAR file

Step 1

On the command line, in the directory where your assignment is located, type:

jar -cfv LabName.jar Labxx.*

This statement will create a file called LabName.jar which contains all of the files in the current directory whose names begin with Labxx (Labxx.java and Labxx.class). If there are oher files which also need to be inlcuded in the JAR file whose names do not being with Labxx then the names of the additional files can be written after Labxx.* on the command line.

jar -cfv LabName.jar Labxx.* otherFiles.*

The switch 'cfv' tell the JAR command to 'C'reate a 'F'ile and produce 'V'erbose output of the process.

When doing this in the "Real-World" you would substitute Labxx.class for Labxx.* so that your source code would not be included where it could potentially be taken.

The HTML file you created for you applet will still work when the applet is placed in a JAR file except that the HTML file will need to have a line added specifying the archive that the applet class file will be found in. Other than this one line the rest of the HTML file will remain exactly the same.