JAR, WAR and EAR Files in Java Applications:

Abhishek Singh
1 min readFeb 20, 2021

JAR stands for Java ARchive

WAR stands for Web application ARchive

EAR stands for Enterprise Application aRchive

A JAR file extension is .jar and is created with jar command
from command prompt (like javac command is executed). Generally,
a JAR file contains Java related resources like libraries, classes
etc.JAR file is like winzip file except that Jar files are platform
independent.

A WAR file is simply a JAR file but contains only Web related Java
files like Servlets, JSP, HTML, To execute a WAR file, a Web server
or Web container is required, for example, Tomcat or Weblogic or
Websphere, To execute a JAR file, simple JDK is enough.

In J2EE application, modules are packaged as EAR, JAR,
and WAR based on their functionality

JAR: EJB modules which contain enterprise java beans (class files)
and EJB deployment descriptor are packed as JAR files with .jar
extension

WAR: Web modules which contain Servlet class files, JSP Files,
supporting files, GIF and HTML files are packaged as a JAR file
with .war (web archive) extension

EAR: All the above files (.jar and .war) are packaged as a JAR
file with .ear (enterprise archive) extension and deployed
into Application Server.

--

--