Java Reference
In-Depth Information
Note
When more than one
jar
command-line option requires a parameter, the parameters must appear
in the same order as the command-line options. That is, if the command-line options are
-cvfm
, then the
output filename must appear before the manifest file name (since the
f
appeared before the
m
). However, if
the command-line options provided were
-cvmf
, then the manifest file name must appear before the output
filename (since the
m
appeared before the
f
).
■
There are other options you can use with the
jar
tool. Running
jar -help
will give a
brief synopsis of the various arguments and usage options. Figure 9-5 captures the
sampleproject.jar
file creation in the root directory using the command:
jar -cfm sampleproject.jar Manifest.mf -C classes .
■
Caution
There is one period in the command line following the directory named classes. It is easy to
miss that period in a book, particularly when it occurs at the end of a sentence. If you are unsure of the
command line we used, compare it with Figure 9-5.
Using the
-v
option will display verbose output detailing which files are being added to
the JAR and information related to file compression. To display verbose information, replace
-cfm
with
-cvfm
in the
jar
command.
Figure 9-5.
Creating the sampleproject.jar file
Running the Denny's DVDs Application
The Denny's DVDs application runs in multiple modes, depending on the command-line
options provided. These modes are presented in the following sections.