Java-based packaging of jar, war, ear package and the difference between the detailed

Source: Internet
Author: User
Tags comparison table

Java-based packaging of jar, war, ear package and the difference between the detailed

From an end-customer perspective, a jar file is an encapsulation, and they don't need to know how many. class files are in the jar file, and the function and function of each file also gives them the desired result. In addition to the jar, there are war and ear ears for the Java EE.

Comparison Table
Jar War Ear
English name java Archive file web Archive file enterprise Archive File
Include content Class, properties file, is the smallest unit of file encapsulation, including Java Class Common library, resources, auxiliary files (auxiliary files), etc. Servlets, JSP pages, JSP tag libraries, jar library files, html/xml documents, and other common resource files, slices, audio files, etc. In addition to including jars and wars, EJB components are included
Deployment files Application-client.xml Xml Application.xml
Container Application Server (application servers) Small Service Program container (servlet containers) EJB container (EJB containers)
Level Small In Big

The role and difference of the 1.jar.war.ear package

I. Jar: Usually the development time to refer to the generic (JAVA) class, into a package for easy storage management;

II. War: is to do a (web) application, usually a Web site, into a package deployed into the container;

III. Ear: Enterprise applications, in fact, the ear package contains a war package and several enterprise-level project configuration files, the general server select WebSphere, etc., will use the ear package. Typically, an EJB is called into an ear packet.

2. When to use a war or jar file

I when your project is not fully completed, not suitable for the use of the war file, because your class will often change because of debugging, such as to delete, create a war file is very uncomfortable, preferably your project has been completed, do not change, then hit a war bag it, At this point a war file is equivalent to a Web application, and a jar file encapsulates a class and some related resources into a package for easy reference in the program.

Both the Ps:war package and the jar package are packaged using the jar command.

Java-based packaging of jar, war, ear package and the difference between the detailed

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.