Name
jar — Java Archive Tool
Synopsis
jar c|t|u|x[f][m][M][0][v] [jar-file
] [manifest
] [-Cdirectory
] [input-files
] jar i [jar-file
]
Description
jar is a tool that can create and manipulate Java Archive ( JAR) files. A JAR file is a ZIP file that contains Java class files, auxiliary resource files required by those classes, and optional meta-information. This meta-information includes a manifest file that lists the contents of the JAR archive and provides auxiliary information about each file.
The jar command can create JAR files, list the contents of JAR files, and extract files from a JAR archive. In Java 1.2 and later, it can also add files to an existing archive or update the manifest file of an archive. In Java 1.3 and later, jar can also add an index entry to a JAR file.
The syntax of the jar command is reminiscent of the Unix tar (tape archive) command. Most options to jar are specified as a block of concatenated letters passed as a single argument rather than as individual command-line arguments. The first letter of the first argument specifies what action jar is to perform; it is required. Other letters are optional. The various file arguments depend on which letters are specified.
As in javac, any command-line argument that begins with @ is taken to be the name of a file that contains options or filenames.
Command options
The first letter of the first option to jar specifies the basic operation jar is to perform. The available options are:
-
c
Creates a new JAR archive. A ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.