Environment
RedHat Linux 9 + vwware 8.0 + SSH 3.2.9 + Putty 0.62
Problem
Pack compressed war, unpack war packs, and JAR commands under Linux
Solve
Pack the files in the Project_a folder into Project.war
1. Packing
JAR-XVF project.war/project_a
-C Create War package
-V Display process information
-f Specifies the jar filename, which is usually required
-M does not produce a manifest for all items (manifest) file, this parameter ignores the-m parameter
-0 This is the Arabic numeral, only packing does not compress the meaning
2. Decompression
JAR-XVF Project.war
Extract to current directory
Jar Commands Detailed
Using the jar command without any, we can see the use of the Jar command as follows:
jar {ctxu}[vfm0m] [jar-file] [manifest-file] [-c directory] filename ...
where {CTXU} is a child command of the jar command, each time the jar command can contain only one of the CTXU, they represent:
-C Create a new jar file package
-t List of contents of jar packages
-X expands the jar package's specified file or all files
-U update jar packages that already exist (add files to jar packages)
In particular, in the release of the parameters, c/x/t/u can only exist one! Not exist at the same time!
Because it is not possible to compress and decompress at the same time.
-Z: Do you have gzip properties at the same time? Is that the need to use gzip compression?
-j: Do you have bzip2 properties at the same time? That is to use bzip2 compression?
-V: Display files during compression! This is commonly used, but is not recommended for use in the background execution process!
-f Specifies the jar filename, which is usually required
Please note that immediately after the F to receive file name Oh! Don't add any more parameters!
For example, the use of "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" is right!
-P: Use the original properties of the original file (properties will not be changed according to the user)
-P: You can use absolute paths to compress!
-N: Newer than the following date (YYYY/MM/DD) will be packaged into the newly created file!
–exclude file: Do not package file in the process of compression!
-m Specifies the manifest manifest file to include
-0 storage, no compression, so that the resulting jar package will be larger than the size of the parameter, but faster
-M does not produce a manifest for all items (manifest) file, this parameter ignores the-m parameter
[jar-file] is a jar package that needs to be generated, viewed, updated, or unpacked, which is a subsidiary parameter of the-f parameter
[manifest-file] is the manifest manifest file, which is a subsidiary parameter of the-m parameter
The [-C directory] represents the action to go to the specified directory to perform this jar command. It is equivalent to using the CD command to go to the directory and then execute the JAR command without the-c parameter, which can only be available when creating and updating jar packages.
Filename... Specifies a list of files/directories that are files/directories to add to the jar package. If a directory is specified, all files and subdirectories in that directory are automatically bundled into the package when the JAR command is packaged.