jar files: These files are with the .jar extension. The .jar files contain
the libraries,
resources and accessories files like property files.
.war files: These files are with the .war extension. The war file contains
the web
application that can be deployed on the any servlet/jsp container. The .war
file contains
jsp, html, javascript and other files for necessary for the development of
web applications.
.ear files: The .ear file contains the EJB modules of the applications.
==============================================================
* Jar files (files with a .jar extension) are intended to hold generic
libraries of Java
classes, resources, auxiliary files, etc.
* War files (files with a .war extension) are intended to contain
complete Web
applications. In this context, a Web application is defined as a single
group of files,
classes, resources, .jar files that can be packaged and accessed as one
servlet context.
* Ear files (files with a .ear extension) are intended to contain
complete enterprise
applications. In this context, an enterprise application is defined as a
collection of .jar
files, resources, classes, and multiple Web applications.
Each type of file (.jar, .war, .ear) is processed uniquely by application
servers, servlet
containers, EJB containers, etc.
==============================================================
JAR files (Java ARchive) allows aggregating many files into one, it is
usually used to hold
Java classes in a library. i.e. Math.jar
WAR files (Web Application aRchive) stores XML, java classes, and
JavaServer pages for Web
Application purposes.
EAR files (Enterprise ARchive) combines JAR and WAR files to make a
combined archive for
Enterprise Applications.
============================================================================
The JavaTM Archive (JAR) file format enables you to bundle multiple files
into a single
archive file. Typically a JAR file will contain the class files and
auxiliary resources
associated with applets and applications.
WAR files are useful for importing complete web applications into a web
server engine or to
a development environment. While WebSphere Application Server does not
support the direct
importation of web applications from WAR files into the Application Server,
a tool is
provided that converts the WAR file to a format using XML that can be
imported by the
Application Server using either the console or a command line. A separate
command line
statement can be used to convert the WAR file into a webapp format that can
be imported into
a stand-alone server environment or a development environment such as
VisualAge for Java
War files are web application archive files. War files are actually jar
files. They are created by using the jar utility. The different extension
between these two files are chosen to let people treat them differently.
War files can be mapped to URL prefix path on the server and thus they
can handle all requests beginning with that prefix. As an example, if we
put all files for assignment 2 into edu\hawaii\courseapp\multi and
zip it, after unzip it, all these files starts with the URL(assume
edu\hawaii\courseapp\multi is a prefix which represents a starting part of
URL). It provides a convenient way to handle a collection of files which
are used on an application.
You can use Internet Explorer 5.0 to save files with .war extension.
An .ear file is an “Enterprise Archive” file. The file has the same format
as a regular .jar
file (which is the same as ZIP, incidentally). The .ear file contains
everything necessary
to deploy an enterprise application on an application server. It contains
both the .war (Web
Archive) file containing the web component of the application as well as
the .jar file. In
addition there are some deployment descriptor files in XML.
http://java.sun.com/j2ee/j2sdkee/techdocs/guides/ejb/html/Overview.fm.html
contains
additional information.