Wednesday 9 October 2013

What is the difference between EAR, JAR and WAR file

What is the difference between EAR, JAR and WAR file?




JAR : JAR (Java ARchive)is a platform-independent file format that aggregates many files into one. Typically a JAR file contains the class files and auxiliary resources like libraries files, properties file, image, sound etc.
JAR file consist of a ZIP archive and an optional Manifest file, which contains package and extension related data. The Manifest file will have the name 'MANIFEST.MF'. This manifest file belongs to the optional directory named 'META-INF'. This directory is used to store package and extension configuration data, security related data, version related data, services related data, etc.
A JAR file can be created by using the 'jar' command line utility OR if you wish to create JAR files pro-grammatically then you may use java.util.jar package for required APIs.



WAR : (Web Application aRchive) It is used to deployed in web application like Tomcat. It typically contains servlets, JSPs and their supporting classes and files. A servlet container like Tomcat is required to deploy these file. There are special files and directories within a WAR file. A WAR has a specific directory structure. The top-level directory of a WAR is the document root (WEB-INF) of the application. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored. WEB-INF contains web.xml, classes, lib and Tag library descriptor files.



EAR : (Enterprise ARchive) An EAR file is a standard JAR file with a .ear extension which is a generally J2EE application. It contains one or more entries representing the modules of the application, and a metadata directory called META-INF which contains one or more deployment descriptors. It is a top-level container which contains modules like: EJB modules, web modules, application client modules etc and deployed to an application server like WebLogic, WebSphere, JBOSS, etc. It might contain WARs, JARs, etc.
combines JAR and WAR files to make a combined archive for Enterprise Applications.
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. 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 Deployment Descriptor, which is used by the Application Server to deploy the enterprise application correctly.


No comments:

Post a Comment

Very Impotent Links for Java and Portal development development

Jar Download for Spring  Maven Or Gradel Dependency for Spring