JAVA Tip: Several ways to package war __java

Source: Internet
Author: User

1. First of all, tools like eclipse are handy.
2. With tools such as WinRAR, the Web-info directory, as well as all the directories and files with it, packaged into a zip file, and then change the extension to war!
3 jar Command:
Suppose you have a Web application: C:/myhome
myhome/web-inf/...
Myhome/files/...
myhome/image/...
myhome/src/...
myhome/index.jsp
Under the Command Line window, execute the following command:
C:/>CD MyHome
C:/myhome/>jar CVF Myhome.war * *.
Explanation: Jar CVF [a=] War package name].war [b= resource files and folders] [c= will generate the target folder for the war package]
"*/" (b=) represents all files and folders under the current directory (C:/myhome).
"." (c=) indicates that the war package will be generated in the current directory.
Once the operation is complete, the use of the generated war package can be deployed. For example, in a Tomcat container: Find the newly generated Myhome.war under C:/myhome, copy it into tomcat_home/webapps/, and then start TOMCAT.
Attached: jar command usage: jar {ctxui}[vfm0me] [jar-file] [manifest-file] [entry-point] [-c dir] files ...
Options include:
-C Create a new archive
-t lists the archive directory
-X uncompress archived specified (or all) files
-U Update Existing archive
-V generating verbose output in standard output
-F Specify archive file name
-M contains the manifest information in the specified manifest file
-e a standalone application bundled to an executable jar file
Specify application entry points
-0 storage only; Do not use any ZIP compression
-M does not create a manifest file for an entry
-I generates index information for the specified jar file
-C changes to the specified directory and contains the files in it
If there is any directory file, it is recursively processed.
Specified order of manifest file name, archive file name, and entry roll
The same order as the "M", "F" and "E" flags are specified.
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/.

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.