The difference between a jar package and a war package

Source: Internet
Author: User

the difference between a jar package and a war package is that a jar package is a class that someone else has already written, and then they are packaged, and you can bring the jar packages into your project, and then you can directly use the classes and attributes in those jar packages, which are typically placed in the Lib directory. 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. Ear Package: An enterprise application, typically an EJB that is called an ear package. 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, and there will be a Web-inf directory, which is 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 the application, and the classes directory contains the compiled servlet classes and other classes that the JSP or servlet relies on (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.

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.