Jar package and jar package command
Jar is a standard java packaging command, which is located under the JAVA_HOME/bin/directory. The main function is to package multiple files into a separate jar file.
Jar c [v0Mmfe] [manifest] [jarfile] [entrypoint] [-C dir] inputfiles [-Joption]
Jar u [v0Mmfe] [manifest] [jarfile] [entrypoint] [-C dir] inputfiles [-Joption]
Jar x [vf] [jarfile] [inputfiles] [-Joption]
- Show Jar package structure
Jar t [vf] [jarfile] [inputfiles] [-Joption]
- Add an index to a jar file
Jar I jarfile [-Joption] [] indicates the optional parameter: jarfile: The target jar File Created, updated, decompressed, or displayed. inputfiles: file or directory is used together with the-f option, multiple files or directories are separated by spaces, indicating the files or directories to be packaged, the files or directories in the jar package to be decompressed, and the files or directories of the jar package to be displayed. If it is a directory, it will be processed recursively. Multiple files are compressed in zip mode, unless you add the 0 option manifest: Specify the manifest file, and use entrypoint with the-m parameter: Specify the class name as the application entry, used with the-e option. In particular, the order of manifest, jarfile, and entrypoint corresponding to the-m,-f, and-e parameters must be the same-C dir: Specifies the inputfile directory after processing inputfiles, you can have multiple-C dir inputfile-Joption: Specifies the Java runtiome environment parameter.-J and option cannot have space options: c create new jar package u update existing jar package x decompress specified jar package t display jar package content f and jarfile together use v output details 0 do not use zip compression M to generate jar when creating a package, do not create a manifest file. m and manifest are used together with e and entrypoint, specifies the entry Class of the program and writes it to the generated manifest file, corresponding to Main-Class. If the package is used with manifest and the manifest name is Main-Class, an error occurs.