Monday, October 25, 2010

Deployment : war, ear and jar files

Difference between ear, war and jar files.

Enterprise Application ( .ear )

An Enterprise Application consists of one or more of the following J2EE applications or modules:
  • Web applications
  • Enterprise Java Beans (EJB) modules
  • Resource Adapter modules
An Enterprise Application is packaged as an archive file with an .ear extension
you can say it's a collection of war & jar files

Web Application ( .war )
A Web application always includes the following files:
  • A servlet or JSP page, along with any helper classes.
  • web.xml deployment descriptor, a J2EE standard XML document that configures the contents of a WAR file.
Web applications may also contain JSP tag libraries, static .html and image files, supporting classes and .jar files, and a weblogic.xml deployment descriptor, which configures WebLogic Server-specific elements for Web applications. 

Enterprise JavaBean ( .jar )

Enterprise JavaBeans (EJBs) are reusable Java components that implement business logic and enable you to develop component-based distributed business applications. EJB modules are packaged as archive files having a .jar extension.


Deployment units that are packaged using the jar utility have a specific file extension depending on the type:
  • EJBs and client archives are packaged as .jar files.
  • Web applications are packaged as .war files.
  • Resource adapters are packaged as .rar files.
  • Enterprise applications are packaged as .ear files, and can contain other Java EE modules such as EJBs, JDBC, JMS, Web Applications, and Resource Adapters.
  • Web Services can be packaged either as .war files or as .jar files, depending on whether they are implemented using Java classes or EJBs. Typically, the .war or .jar files are then packaged in an Enterprise Application .ear file.
  • Java EE libraries are packaged either as an Enterprise Application (.ear file) or as a standard Java EE module.
  • Client applications and optional packages are packaged as .jar files.


  1. Hi Mukesh,

    The information regarding war,ear,jar files cleared my doubts

    thanks a lot
    --------Kumara Guruparan R

  2. Why should one use multiple ear deployments for different application components? If they all include a set of common libraries, doesn't this introduce unnecessary redundancy?