Reference documents
Http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/jar.html
Http://blog.chinaunix.net/uid-692788-id-2681132.html
Feature Description:Java Archive Tool
Syntax:jar [ command options ] [manifest] Destination input-file [Input-files]
Additional notes:
JarTool is aJavaApplication, you can combine multiple files into a singleJARArchive file.Jaris a multi-purpose archive and compression tool based onZIPAndZLIBCompressed format. However, the designJarThe main purpose is to facilitate theJava appletOr the application is packaged into a single archive file. Willappletsor components of the application(. Classfiles, images, and sounds)When combined into a single archive file, you can use theJavaAgent(such as browser)At onceHTTPInstead of requiring a new connection for each component, they are downloaded during transaction processing. This greatly shortens the download time.JarFiles can also be compressed, which further increases the download speed. In addition, it allowsappletsAuthor to sign each item in the file, and thus can certify its source.JarThe syntax of the tool is basicallyTarThe syntax of the command is the same.
Command Options :
- C Create a new archive or an empty archive on the standard output.
- t lists the table of contents on standard output.
-x[file] extracts all files from standard input, or extracts only the specified files. If file is omitted, all files are extracted, otherwise only the specified file is fetched.
-f The second parameter specifies the jar file. In -c ( create case, the second parameter refers to the ( not on standard output . In -t ( table or -x ( Extract in either case, the second parameter specifies the jar file.
- v the output of the growth format on the standard error output device.
- m includes manifest information from the specified existing manifest file. Usage Example: "jar CMF mymanifestfile myjarfile *.class"
-0 storage only, no zip compression.
- m does not create a manifest file for the project.
- u updates an existing JAR file by adding a file or changing the manifest. For example: "jar-uf foo.jar foo.class" adds the file foo.class
Added to the existing jar file Foo.jar , while "jar UMF manifest Foo.jar" is updated with the information in manifest Foo.jar the list.
- c changes the directory during the execution of the Jar command. For example: "jar-uf foo.jar-c Classes *" adds all files in the classes directory to Foo.jar
, but does not add the class directory itself.
Examples of programs :
1: package All the CLASS files in the current directory into a new JAR file:
Jar CF File.jar *.class
2: display a list of files in a JAR file
Jar TF File.jar
3: Add all the files in the current directory to a JAR file that already exists
Jar CVF File.jar *
Jar--Java Document archiving tool