Java Beans   «Prev 

JavaBeans options argument

Unlike most command-line tools, the JAR utility does not require the use of a / or - when specifying options.
What are the mandatory and optional parameters for the jar utility command?
The jar utility command is used to create, manipulate, and extract files from Java Archive (JAR) files. Here are the mandatory parameters for the jar command:
jar {c|t|x|u}[vfmn0PMe] [jar-file] [manifest-file] [-C dir] files ...

  1. c: create a new JAR file.
  2. t: list the contents of a JAR file.
  3. x: extract files from a JAR file.
  4. u: update an existing JAR file.

Here are some of the common optional parameters for the jar command:
  1. v: generate verbose output.
  2. f: specify the name of the JAR file.
  3. m: include a manifest file in the JAR file.
  4. n: perform Pack200 normalization on the JAR file.
  5. 0: store only; use no compression.
  6. P: preserve the leading '/' (absolute path) and ".." (parent directory) components from file names.
  7. M: do not create a manifest file for the entries.


The -C option is also optional and is used to specify the directory that contains the files to be added to the JAR file.
Note that the actual parameters that you need to use will depend on the specific task that you want to perform with the jar utility. You can get more information on the jar command and its options by running jar --help.

Below is a listing of the options utilized by the JAR utility:
Option Description
f Identify the name of the archive as the first file in the Files argument.
c Create a new archive.
m Create a manifest file for an archive based on an external manifest file. (The external manifest file is provided as the second file in the Files argument.)
t List the contents of an archive.
x Extract all the files in an archive, or just the files provided in the Files parameter.
v Output detailed information about the actions being performed.