. The difference between jar/war/ear packages

Source: Internet
Author: User
Tags rar time and date java web

From the perspective of the end customer, the. jar file is an encapsulation, and they don't need to know how many. class files in a jar file, the functions and roles in each file, can also get the results they want. Besides jars, there are war and ear for the Java EE. The difference is shown in the following table:

Jar

WAR

EAR

English Java Archive File Web Archive File Enterprise Archive File
Include content Class, properties file, is the smallest unit of file encapsulation; Servlet, JSP pages, JSP tag libraries, jar library files, html/xml documents, and other common resource files, such as pictures, audio files, and so on; In addition to containing jars, war, EJB components are included
Deployment Files Application-client.xml Xml Application.xml
level Small In Big

We often see jar/war/ear these file types in our Java Web project, what's the difference between them. I looked up some of the data summarized as follows:
Jar/war/ear three kinds of files, in the file structure, the three are not different, they are in the zip or jar file compression format. But they are used for different purposes:
Jar file (with the extension. Jar) contains common libraries, resources, and auxiliary files (auxiliary files) for Java classes
The war file (. war extension) contains all the 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 ear file (. ear extension) 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.
JAR WAR EAR
English Java Archive file; Web Archive file Enterprise Archive file
Jar: Contains content class, properties file, is the smallest unit of file encapsulation; War:servlet, JSP pages, JSP tag libraries, JAR library files, html/xml documents, and other common resource files, such as pictures, audio files, etc. ear: In addition to including jars, war, also includes EJB components
Deployment Files Application-client.xml Web.xml Application.xml
Small and medium size
Jar: Encapsulation Class War: Encapsulating 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") was a JAR file used to distribute a collection of JavaServer pages, Servlets, Java classes, XML files, tag libraries and static Web Pages (HTML and related files) that T Ogether constitute a WEB application.
Ear:an Enterprise ARchive, or EAR, is a file format used by Java EE for packaging one or more modules to a single Archi ve so this deployment of the various modules onto an application server happens simultaneously and coherently. It also contains XML files called deployment descriptors which to describe the deploy. Maven or Ant can is used to build EAR files.
Rar:a Resource Adapter is a archive file format defined in the Java EE Connector Architecture (JCA) specification. A Resource Adapter aRchive (RAR) file is the valid format for deployment to Resource on adapters application. Java EE RAR files may also is called connectors.

Other Concepts:
Ejb:enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of Enterprise AP Plications. 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 the application.
Javabean:javabeans are reusable software components for Java, can is manipulated visually in a builder tool. Practically, they are classes written in the Java programming language-conforming to a particular. They are used to encapsulate many in a single object (the bean), so that objects can is They passed as a single B Ean object instead of as multiple individual objects. A JavaBean is a Java Object this 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 is created, what standards u Sed (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.