Manually hit the jar pack for help class and fight the war package for the Web project

Source: Internet
Author: User

Once the Java JDK is properly configured, you can call the jar command directly, or you can run the Jar.exe command into the JDK's Bin directory


1. Make a jar of the already written help class


(1) Open the DOS Command Prompt window and enter the jar directly and the Help command appears as follows:

where (-C,-V,-f) These three commands are common:- CCreate a new document - vgenerate verbose output to standard output- F Specifies the archive file name.

Microsoft Windows [version 6.1.7601]
Copyright (c) Microsoft Corporation. All rights reserved.
C:\users\songyanjun>jar
usage: jar {ctxui}[vfm0me] [jar-file] [manifest-file] [entry-point] [-C dir] file
s ...
options include:
-C Create a new archive file
- t lists the archive directory
- x Unzip the archived specified (or all) files
-U Update existing archive file
- v generates verbose output in standard output
- f Specifies the archive file name
-M contains inventory information from the specified manifest file
-E is a standalone application bundled into an executable jar file
Specify the application entry point
0 store only; do not use any ZIP compression
-M does not create an entry for the manifest file
-I generate index information for the specified jar file
- c changes to the specified directory and contains the files therein
If there is any catalog file, it is recursively processed.
the specified order of the manifest file name, archive file name, and portal name
is the same as the specified order for the "M", "F", and "E" flags.

Example 1: Archive two class files into an archive named Classes.jar:
jar CVF Classes.jar foo.class bar.class
Example 2: Use the existing manifest file "Mymanifest" and
Archive All files in the foo/directory to "Classes.jar":
jar CVFM Classes.jar mymanifest-c foo/.

c:\users\songyanjun>

(2) Enter the directory where you want to hit the jar

CD D:\MyInstalltion\apache-tomcat-6.0.20\webapps\Stars\WEB-INF\classes
           
The following actions are shown:
          
C:\users\songyanjun>d:
D:\>CD D:\MyInstalltion\apache-tomcat-6.0.20\webapps\Stars\WEB-INF\classes
D:\myinstalltion\apache-tomcat-6.0.20\webapps\stars\web-inf\classes>jar CVF starS.jar * *

           
The above three commands can be seen as shown below (because part of the content is too much, the effect is written in part)            

Mark List (manifest)
added: com/stars/web/utils/(read in = 0) (write = 0) (0 stored)
added: Com/stars/web/utils/alert.class (read in = 1186) (write = 659) (compressed 44%)
added: Com/stars/web/utils/baseaction.class (read in = 1254) (write = 585) (compressed 53%)
added: Com/stars/web/utils/basepath.class (read in = 1089) (write = 580) (compressed 46%)
added: Com/stars/web/utils/datapage.class (read in = 1502) (write = 670) (compressed 55%)
added: Com/stars/web/utils/dateutils.class (read in = 1518) (write = 756) (compressed 50%)

            ....  ......   .....
added: Com/stars/web/utils/filemd5.class (read in = 3887) (write = 2070) (compressed 46%)
added: Com/stars/web/utils/stringutils.class (read in = 3821) (write = 1958) (compressed 48%)
added: Com/stars/web/utils/uploadfile.class (read in = 5292) (write = 2848) (compressed 46%)
added: Com/stars/web/utils/usermsgbox.class (read in = 2413) (write = 1040) (compressed 56%)

d:\myinstalltion\apache-tomcat-6.0.20\webapps\stars\web-inf\classes>

(3) call into Jar Package command:JAR-CVF Stars.jar * *

(Explanation:Test.jar is the name of the jar package you created,
 *.*  means you're going to put everything in that directory into a jar bag,
can also
*.classetc... )。


(4) Use the compression tool to view the contents of the jar package you just punched.

You can view the internal structure by changing the package suffix jar to rar or zip directly.


2. Make the project file into a war package

Open the DOS command Prompt window, locate the directory where the item is located and copy its address path;
Example:D:\MyInstalltion\apache-tomcat-6.0.20\webapps\Stars

Execute the following command:

JAR-CVF Stars.war * * (Explanation: JAR-CVF project name. War *. *)


Manually hit the jar pack for help class and fight the war package for the Web project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.