Create a war package in eclipse

Source: Internet
Author: User

Eclipse war package method favorites
I searched for the eclipse packaging method on the Internet for a long time and did not find a better solution. I knew that I could package it by using commands, I have been looking for methods like JBuilder development tools that can be compiled together with war packages. I can't find them. So I finally learned how to do it. Now I want to write down my experience and share it with you. I hope I can help my friends who need it.

If anything is wrong, please correct it.

First open the project to be packaged, select "deploy myeclipse J2EE project to server... "--> open the" manage deployments "window, select the project to be packaged in the project option, and click" add "on the right to open the" new deployment "window ", select a server in the server option, select "packaged archive (production mode)" in the deploy type option, and then click "finish". Then, return to the "manage deployments" window and click "OK ", finally, you can run the project. At this time, you open the server, such as the tomcat installation path, open the wabapps directory, you can see the packaged war file named after the project.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/heartsky189/archive/2009/03/28/4032028.aspx

 

-----------------

Most of you will encounter a. War Packaging Problem When developing Web applications using Java. If the JB development tool is used, you can directly create a web project and compile it to generate a. War file. Recently, in order to prepare for the nit-Pro test, I used my favorite eclipse development tool and did not directly provide the. War packaging command, which worried me for a while. Now I have learned how to use this command. I feel that every effort and knowledge is growing. This section describes how to package. War from the command line:

In cmd, when we break down Jar-help, the system provides the following JAR commands and jar packaging:

Usage: jar {ctxui} [vfm0me] [Jar-file] [manifest-file] [Entry-
S...
Options include:
-C. Create a new archive file
-T list the archive Directories
-X decompress the archived specified (or all) File
-U: update existing archive files
-V generates detailed output in standard output
-F specifies the archive file name
-M: contains the configuration information in the specified configuration file.
-E is an independent application bound to an executable JAR file.
Application entry point
-0: storage only; no zip compression is used
-M: do not create a list file.
-I generate index information for the specified JAR File
-C: change to the specified directory and include the files.
If any directory file exists, recursive processing is performed on it.
The order in which the configuration file name, archive file name, and entry name are specified
The specified sequence is the same as that of the "m", "F", and "E" flag.

Example 1: Archive two class files to an archive file named classes. jar:
Jar CVF classes. Jar Foo. Class bar. Class
Example 2: Use the existing inventory file "mymanifest" and
Archive all files in the foo/directory to "classes. Jar:
Jar cvfm classes. Jar mymanifest-C Foo /.

Now we use the jar command to package war:

Run cmd to enter the command prompt line and locate the project path. For example, if your project name is "classes,

You can run it to D: \ Classes.

Run jar CVF classes. War */. (here, there is a point that contains all the files in this folder.

Then put the package file to % Tomcat _ home % webapps/classes. War (classes. War is the project file I packaged, and you just need to replace it with your project package file)

Start Tomcat again, and enter http: // localhost: 8080/classes in the address bar to access it. (You may find that when you put the war package you typed under the webapps directory, after the page is refreshed, it is automatically decompressed into the previous folder. This is the function of the Tomcat server .)

Source: xuewang (www.xue5.com), original address: http://www.xue5.com/itedu/200707/134317.html

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.