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/.