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.