Java--web Project packaged as a war file method __java

Source: Internet
Author: User

Several ways to package Web applications as war files:

(1) using the jar command at the command line

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.

After the operation is complete, locate the newly generated Myhome.war under C:/myhome and copy it into tomcat_home/webapps/. Then start Tomcat.

(2) Packaging with IDE tools, such as Eclipse

Right click on the file or project you want to package, select "Export", then choose Java, in the pop-up dialog box select "War File", there are many options, but also choose "EAR", "JAR", personally feel this very convenient.

(3) Pack with Ant tools

First configure the Build.xml file, and then enter the Ant in Dos ... war

(4) using Eclipse's Lomboz plugin

Select your Web project, Lomboz java---Deploy Module, you can publish and package 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.