| There is no difference in the file structure between the three. They all adopt ZIP or JAR File compression formats. However, they have different purposes:
JAR File(Extension:. Jar) contains Java class common library, resources, auxiliary files, etc.
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).
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.]
========================================================== ======================================
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 |
========================================================== ======================================
These three types of files can be viewed as Java compression formats. The essence is to implement different encapsulation: Jar -- encapsulation class war -- encapsulate web site ear -- encapsulate EJB. Their relationship is: jar: Java achieve-class packages compressed in Java format, including the content class, properties file, is the minimum unit level of file encapsulation: small war: is file web achieve-contains servlet, JSP page, JSP tag library, Jar library file html/XML file and other public resource files, Chip, audio file level: Medium ear: is File enterprise achieve -- in addition to jar, war, but also includes EJB component deployment file application-client.xml web. XML application. XML level: a Web component developer executes the following tasks to pass a war file containing Web components: | compile and compile Servlet Source Code | compile JSP and HTML files | specify the web development descriptor | specify .class,.jsp,.html and deploy descriptor to a war file. 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 ear can contain war and jar files. Jar files can include ejbs. War can include Web components.
Jar indicates the standard file of Java, which has an interesting puntion: a jar of beans (a can of beans ). Bytes. However, they have different purposes:
JAR File(Extension:. Jar) contains Java class common library, resources, auxiliary files, etc.
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).
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.]
All packages are jar files, but the extension of the target file is different.
Ear package: enterprise-level applications. Generally, EJB is packaged into an ear package. Ear is the extension of J2EE application files. Yesenterprise application achiever,
Is a packaged enterprise application, which can contain war (Web application archiever), EJB, and other ear packages: enterprise-level applications, usually EJB into an ear package. War package: After a web application is created, it is usually a website, which is packaged and deployed into a container.
Jar package: Generally, generic classes must be referenced during development. Packaging is convenient for storage and management. |