Differences between. Jar/war/ear packages

Source: Internet
Author: User

From the perspective of the end customer ,. jar files are an encapsulation that they do not need to know. how many jar files are there. class files, the functions and functions of each file can also get the expected results. In addition to jar, there are war and ear for J2EE. The differences are as follows:

 

Jar

War

Ear

 English Java archive file Web archive file Enterprise archive file
 Included content The class and properties files are the smallest units in file encapsulation; Servlet, JSP page, JSP tag library, Jar library file, HTML/XML file and other public resource files, files, audio files, etc; In addition to jar and war, it also includes EJB components.
 Deployment File Application-client.xml Web. xml Application. xml
 Level  Small Medium Large

 

 

We often see JAR/war/ear file types in Java Web projects. What are the differences between them? I checked some materials and summarized them as follows:
Jar, war, and ear files use ZIP or JAR File compression formats. However, they have different purposes:
Jar files (with the extension. Jar) include common libraries, resources, and auxiliary files of Java classes.
The war file (with the 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 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 processed by application servers, servlet containers, and EJB containers.
Jar war ear
Java archive file; web archive file enterprise archive file
Jar: contains the class and properties files. It is the smallest unit of file encapsulation. War: servlet, JSP page, JSP tag library, Jar library file, HTML/XML file, and other public resource files, files, and audio files; ear: Besides jar and war, it also includes EJB components.
Deployment file application-client.xml web. XML application. xml
Level small medium large
Jar: encapsulation class war: encapsulation web site ear: can encapsulate EJB
Jar: software developers generally use. jar files to distribute Java applications or libraries, in the form. of classes and associated metadata and resources (text, images, etc .) jar files build on the zip file format.
War: in computing, a war file (which stands for "Web application Archive") is a jar file used to distribute a collection of assumerver pages, Servlets, Java classes, XML files, tag libraries and static web pages (HTML and Related Files) that together constitute a web application.
Ear: An enterprise archive, or ear, is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. it also contains XML files called deployment descriptors which describe how to deploy the modules. maven or ant can be used to build ear files.
RAR: A Resource adapter is an archive file format defined in the J2EE Connector Architecture (JCA) specification. A resource adapter archive (RAR) file is the valid format for deployment of resource adapters on application servers. j2EE RAR files may also be called connectors.

Other concepts:
EJB: Enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of enterprise applications. the EJB specification is one of several Java APIs in the Java ee. EJB is a server-side model that encapsulates the business logic of an application.
JavaBean: JavaBeans are reusable software components for Java that can be manipulated visually in a Builder tool. practically, they are classes written in the Java programming language conforming to a participant convention. they are used to encapsulate your objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A Javabean is a Java object that is serializable, has a nullary constructor, and allows access to Properties Using getter and setter methods.
Metadata: metadata is a means to describe the data files. it provides information about a certain item's content, such as: means of creation, purpose of the data, time and date of creation, creator or author of data, placement on a network (electronic form) where the data was created, what standards used (ISO9000), etc.

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.