• Difference Between JAR, WAR and EAR Files

    In J2EE application, modules are packaged as EAR, JAR and WAR depending on their functionality. This is not any kind of structural difference between these files. All of the are archieved using jar/zip compression.

    A Java Application Server has two containers - one is a Web Container and the other one is a EJB Container.
    The Web container has Web applications in light of JSP or the Servlets API - designed particularly for web request handling, so to a greater degree a request/response style of distributed computing. A Web container requires the web module to be bundled as a WAR document - that is a unique JAR file with a web.xml file in the WEB-INF folder.
    An EJB container has Enterprise java beans in view of the EJB API intended to give expanded business usefulness, for example, declarative method level security, multiprotocol support. EJB compartments require EJB modules to be bundled as JAR files - these have an ejb-jar.xml files in the META-INF folder.
    Enterprise applications may have more than one modules that can either be Web modules (bundled as a WAR document) or EJB modules (bundled as a JAR files) or both. Enterprise applications are packaged as EAR records, these are extraordinary JAR documents containing an application.xml file in the META-INF folder.
    Fundamentally EAR records are a superset containing WAR documents and JAR documents. Java Application Servers permit deployment of standalone web modules in a WAR file, however inside they make EAR files as a wrapper around WAR files. Standalone web containers, for example, Tomcat and Jetty doesn't support EAR records - these are not undeniable Application servers. Web applications in these containers are to be deployed as WAR files as it were.

    1. JAR File (Java Archive) :
    Basically JAR file is compressed using JDk software. There are many other tools available for zipping files. Most of them have one problem i.e. they are platform dependent. A file zipped using winzip cannot be unzipped on Linux. On the other hand JAR file can be zipped and unzipped on any platform where Java is working.
    How to create JAR file?
    Let's say we have 3 files as sample1.txt, sample2.txt, sample3.jpeg and we want to create Demo.jar for these files 

    Run this command on terminal

    <p>&nbsp;[root@localhost DemoJAR]# jar cvf Demo.jar sample1.txt sample2.txt sample3.jpeg</p>

Most Liked Posts

Post A Comment

Your email address will not be published. Required fields are marked*



No Record found
demo content

The Total Economic Impactâ„¢ of ServiceNow

United States Tue Jun 06 2017

Join us for a webinar where we will reveal the quantified value of the Lightspeed Enterprise for customers that are modernizing IT, eliminating service outages, and optimizing performance with real-time analytics.

Guest speakers Liz Witherspoon of Forrester, and study participant Brad Paubel, VP of Internal Technologies at Maritz, will discuss

  • The value drivers for IT and key quantified economic benefits
  • Key challenges that study customers faced and overcame
  • Focus areas and best practices you can use to drive business impact with ServiceNow


Webinar Registration

Enter the characters visible in the box below



Share using

Advertise With Us