JAR file : JAR stands for Java Archive. A jar file is used to store class files. These classes can be imported by other code and methods, member variables and inner classes can be accessed from those class files present in the jar files. In fact, a jar file is nothing but a zip file with file extension changed to .jar.

Optionally, one can also sign jar files to add authenticity to them. The things that make a zip file jar are:

  • Presence of class files in packages (folders)
  • File extension of .jar
  • Optional META-INF folder and META-INF/MANIFEST.MF file

WAR file : WAR stands for Web Archive. WAR files are used to package java web applications. There is a special structure which needs to be followed for web applications. When the application folder and files are zipped then the file can renamed with file extension of .WAR. The advantage of using WAR files is that Java EE based web applications can be sent from one place to another in packaged form. A WAR file can also contain multiple JAR files (usually present in the WEB-INF/lib folder inside the WAR).

EAR file : EAR stands for Enterprise Archive. The EAR files contain the EJB/JPA based packaged applications. The contents of a typical ear file contains a war file, jar file and JAVA EE specific deployment descriptors. In effect, EAR file is also a zip file containing other zip files (war and jar) and some files(deployment descriptor).

Special Note

Note that JAR file can be made executable. WAR and EAR files are used for packaged deployment on servers where the server automatically expands the WAR and EAR file and deploys the application for use. The JAR tool present in $JAVA_HOME/bin folder can be used to create JAR, WAR or EAR files from folders.

Related Posts

What is the difference between JAR,WAR and EAR files admin Core Java
JAR file : JAR stands for Java Archive. A jar file is used to store class files. These classes can be imported by other code and methods, member variables and inner classes can be accessed from those class files present in the jar files. In fact, a jar file...
<strong>JAR file :</strong> JAR stands for Java Archive. A jar file is used to store class files. These classes can be imported by other code and methods, member variables and inner classes can be accessed from those class files present in the jar files. In fact, a jar file is nothing but a zip file with file extension changed to .jar. Optionally, one can also sign jar files to add authenticity to them. The things that make a zip file jar are: <ul> <li>Presence of class files in packages (folders)</li> <li>File extension of .jar</li> <li>Optional META-INF folder and META-INF/MANIFEST.MF file</li> </ul> <strong>WAR file :</strong> WAR stands for Web Archive. WAR files are used to package java <a href="http://www.javaexperience.com/performance-management-for-web-applications/" title="Performance Management in web applications">web applications</a>. There is a special structure which needs to be followed for web applications. When the application folder and files are zipped then the file can renamed with file extension of .WAR. The advantage of using WAR files is that Java EE based web applications can be sent from one place to another in packaged form. A WAR file can also contain multiple JAR files (usually present in the WEB-INF/lib folder inside the WAR). <strong>EAR file :</strong> EAR stands for Enterprise Archive. The EAR files contain the EJB/JPA based packaged applications. The contents of a typical ear file contains a war file, jar file and JAVA EE specific deployment descriptors. In effect, EAR file is also a zip file containing other zip files (war and jar) and some files(deployment descriptor). <h3>Special Note</h3> Note that JAR file can be made executable. WAR and EAR files are used for packaged deployment on servers where the server automatically expands the WAR and EAR file and deploys the application for use. The JAR tool present in $JAVA_HOME/bin folder can be used to create JAR, WAR or EAR files from folders.
What is the difference between POJO,JavaBean and EJB
JVM Memory areas
The following two tabs change content below.
I run this blog with lots of passion. In this website, you will find tutorials on Core Java, Spring, Struts, Web Applications, Portals and Database. Please support me and the website by sharing the posts on your facebook / twitter. You can tap the share button at the top of each post. Thanks for the support.

Latest posts by admin (see all)

Comments

comments