What is the difference between the "turn" Ear, Jar, and War file

Source: Internet
Author: User

What is the difference between an Ear, Jar, and war file? What kind of environment they are used separately.

In the file structure, the three are not different, they are in the zip or jar file compression format, but they use different purposes.

jar file (with the extension. Jar) contains common libraries, resources, and auxiliary files (auxiliary files) for Java classes

The JAR file is Java Archive file, as implies meaning, its application is related to Java, is a Java document format. The JAR file is very similar to a zip file--it's exactly the zip file, so call it a package. The only difference between a jar file and a ZIP file is that it contains a meta-inf/manifest in the contents of the jar file. MF file, this file is created automatically when the JAR file is generated.

Packaging is typically done through JAR commands, and the Meta-inf directory is not generated in the package if packaged through tools such as WinRAR.

War file (with the name extension. War) contains all Web applications. In this case, a Web application is defined as a separate set of files, classes, and resources, and the user can encapsulate the jar file and access it as a small service program (servlet).

The war package is also done through the jar command, which also generates meta-inf/manifest after packaging. MF file.

If you intend to make a Web application publication after the application is made into a war package, the content within the package must conform to the directory structure of the Web application.


Ear File (with the extension. Ear) contains all enterprise applications. In this case, an enterprise application is defined as a collection of multiple jar files, resources, classes, and Web applications.

Each file (. jar,. War,. Ear) can only be handled by the application server (application servers), the Small Service program container (servlet containers), the EJB container (EJB containers), and so on. ]

The ear file includes the entire project, containing multiple EJB module (jar files) and Web module (war file)
The generation of an ear file can use WinRAR zip compression or jar commands.

Jar: Encapsulation Class
War: Encapsulating a Web site
Ear: Can encapsulate EJB

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.