Jar command - Java Java Virtual Machine

Java examples for Java Virtual Machine:Jar

Introduction

The basic format of the jar command is this:

jar options jar-file [manifest-file] class-files...

The options specify the basic action you want jarto perform and provide additional information about how you want the command to work.

The following table lists the options.

Option Description
c Creates a new jarfile.
u Updates an existing jarfile.
x Extracts files from an existing jarfile.
t Lists the contents of a jarfile.
f Indicates that the jarfile is specified as an argument. You almost always want to use this option.
v Verbose output. This option tells the jarcommand to display extra information while it works.
0 Doesn't compress files when it adds them to the archive. This option isn't used much.
m Specifies that a manifest file is provided. It's listed as the next argument following the jarfile.

Create jar file

jar cf utils.jar com\book2s\util\*.class

List jar content

jar tf utils.jar

Related Tutorials