You are on page 1of 16

WAR FILES

INTRODUCTION:
A WAR file (which stands for “Web application archive") is
a JAR file used to distribute a collection of JavaServer
Pages, servlets, Java Classes, XML files, tag libraries and
static Web pages (HTML and related files) that together
constitute a Web application.

File extension: .war


Developed by: Sun Microsystems
Container for: JSP, JavaServlet
USES OF WAR
Web Archive (WAR) file is a Java archive file used to
store jsp, servlets, classes, meta data information,
images and Sound and tag libararies etc.

WAR files are used to package Web modules. A WAR


file is for a Web application deployed to a servlet/jsp
engine
ABOUT JAR FILES
is java archieve file
contain all class file,image,sound and other files which
will be needed in whole application.
users can create or extract JAR files using the jar
command that comes with the JDK. They can also use
zip tools.
the JavaTM Archive (JAR) file format enables you to
bundle multiple files into a single archive file. jar was
designed mainly to facilitate the packaging
COMMANDS FOR JAR
jar cf jar-file input-file(s)
The options and arguments used in this command are:
• Use c option  to create a JAR file.
• jar-file is the name of your  JAR file. You can use any
filename for a JAR file. By convention, JAR filenames
are given a .jar extension,it is mandatory any way
The command for viewing the contents of a JAR file is:
jar tf jar-file
ABOUT EAR FILE
An Enterprise Archive file represents a J2EE application
that can be deployed in a Web Sphere application server
EAR files are standard Java archive files and have the file
extension .ear
contain ejb, web or application client module. ear file is
complete j2ee application file that contain all(jar +war
In short we can say;
EAR = WAR(Web module) + JAR(can be EJB module or
application client module)
DIFFERENCES
WAR JAR EAR
Intended to hold generic Intended to contain Intended to contain
libraries of Java classes, complete Web applications. complete enterprise
resources, auxiliary files, etc. In this context, a Web applications. In this context,
application is defined as a an enterprise application is
single group of files, classes, defined as a collection of .jar
resources, .jar files that can files, resources, classes, and
be packaged and accessed as multiple Web applications.
one servlet context.

.WAR .JAR .EAR


HOW TO CREATE A WAR FILE
STEP 1
STEP2
STEP 3
STEP 4
STEP 5
STEP 6
ADVANTAGES OF WAR FILES
It is a format supported by all the Java application/web

servers.
Build tools support WAR files.

IDEs support creating WAR files.

Integrates library distribution with static and dynamic

web pages.
A single file to distribute.
DISADVANTAGES OF WAR FILES
Some application servers (notably JBoss) implement
radically different classloading rules.
Build time is too early to hard code all configuration
options into the Web Application Deployment Descriptor
The [Java Endorsed Directories] situation makes it
impossible to bundle updates to endorsed libraries inside a
WAR File
The time to build and deploy a WAR file increases with the
size of the application, especially the number of embedded
libraries. The more libraries you use, the longer it takes to
iterate through a build/deploy/test cycle.
THANK YOU !!!

You might also like