Diff Between Jar War And Ear Files Java

What is the difference between EAR, JAR and WAR file?-.jar files: - These files have.jar extension. - A.jar file contains.class files, resources like.java and property files.

Packaging Applications. A Java EE application is delivered in a Java Archive (JAR) file, a Web Archive (WAR) file, or an Enterprise Archive (EAR) file. A WAR or EAR file is a standard JAR (.jar) file with a.war or.ear extension. Using JAR, WAR, and EAR files and modules makes it possible to assemble a number of different.

Difference Between Jar War And Ear Files In Java

- The.jar file can be appended to environment variable CLASSPATH in order to any java application to access from remote package..war files: - These files have the.war extension. - The web application that is to be deployed on servlet or JSP container is too converted into.war file and can be deployed using Tomcat browser. - The.war file can have.jsp, html,.js and any other files which would necessary for a web application..ear files: - The enterprise applications that are to be deployed in EJB container are to be placed in an.ear file. What is the difference between EAR, JAR and WAR file? J2EE defines three types of archives: 1. Java Archives (JAR): - A JAR file encapsulates one or more Java classes, a manifest, and a descriptor.

- JAR files are the lowest level of archive. - JAR files are used in J2EE for packaging EJBs and client-side Java Applications.

Web Archives (WAR): - WAR files are similar to JAR files, except that they are specifically for web applications made from Servlets, JSPs, and supporting classes. Enterprise Archives (EAR): - An EAR file contains all of the components that make up a particular J2EE application.

Taken from internet, but very good explanation: WAR - Web ARchive As the name suggests this file format is used to package all the components of a Web Application. It may contain JARs, JSPs, Servlets, HTMLs, GIFs, etc. The purpose of this archive format is same as that of the JAR - to make the deployment, shipping, and in turn the maintenance process easier. This will have an XML file named web.xml as the Deployment Descriptor.

This Deployment Descriptor is used by the Web Container to deploy the web application correctly. EAR - Enterprise ARchive An enterprise application may be composed of several Web Applications and other independent JARs. This archive file format is used in those cases to bundle all the components of an enterprise application into a single file. Again the purpose is same - making deployment, shipping, and hence the maintenance easier. Microsoft Expression Studio 4 Web. Since, an enterprise application may have several Web Applications as its components, hence an EAR file may contain WARs and JARs. An EAR also contains an XML-based Deployement Descriptor, which is used by the Application Server to deploy the enterprise application correctly.