The difference between a jar package and a war package

Source: Internet
Author: User

The difference between a jar package and a war package:
The war is a Web module that needs to include Web-inf, which is a Web module that can be run directly.

The jar typically includes only some class files that can be run with the Java command after declaring the Main_class. They are all compressed packages, with Tomcat, to put the war file package in its \webapps\ directory, start Tomcat, this package can be extracted automatically, that is, your web directory, the equivalent of publishing.


War package: is a Web application, usually a Web site, into a package deployed into a container.
Jar Package: Typically, a generic class is referenced at development time, and a package facilitates storage management.

All packages are hit with jars, except that the target file has a different extension.
The war is a Web application format presented by Sun, similar to a jar and a compressed package for many files. The files in this package are organized according to a certain directory structure: usually the root directory contains HTML and JSP files or directories containing both files, there will also be a web-inf directory, this directory is very important. Typically there is a Web. xml file and a classes directory under the Web-inf directory, and Web. XML is the configuration file for this application, and the classes directory contains the compiled servlet class and the JSP or servlet Other classes (such as JavaBean). Usually these dependent classes can also be packaged into a jar under the Web-inf Lib directory, of course, can also be placed in the system's classpath, but that porting and management is inconvenient.

How to hit a jar package in eclipse:

The difference between a jar package and a war package

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.