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 Application

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

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

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

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.

This command will also create a default manifest file in the archive. A manifest file is a special file that is included in every JAR file that describes the contents of the file and any special purposes/uses of those contents.

Because no notation has been made in the manifest file to indicate that the JAR contains an executable program, what you have at this point is a non-executable JAR file.