What are the differences between ear, jar, and war files?

Source: Internet
Author: User

What are the differences between ear, jar, and war files? In which environments are they used?

There is no difference in the file structure. They all adopt ZIP or JAR File compression formats, but their usage purposes are different.

JAR File(Extension:. Jar) contains Java class common library, resources, auxiliary files, etc.

Jar files are Java archive files, which are closely related to Java and are a document format of Java. Jar files are very similar to zip files-specifically, they are zip files, so they are called file packages. The only difference between a jar file and a zip file is that the content of the JAR file contains a META-INF/manifest. MF file, which is automatically created when the JAR file is generated.

Generally through jar command packaging, if through WinRAR tools such as packaging, the package will not generate a META-INF directory.

 

 

War File(Extension:. War) contains all web applications. In this case, a Web application is defined as a separate set of files, classes, and resources. You can encapsulate the JAR file and use it as a small service program (servlet).

The war package is also operated through the jar command, the META-INF/manifest. MF file will also be generated after packaging.

If you want to compress an application into a war package and publish it to a web application, the content in the package must conform to the directory structure of the web application.


Ear File(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 processed by application servers, servlet containers, and EJB containers.]

The ear file includes the entire project and contains multiple EJB modules (jar files) and web modules (War files)
You can use the WinRAR zip compression or jar command to generate the ear file.

Jar: encapsulation class
War: encapsulate Web Sites
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.