Search code examples
jakarta-eejarglassfishejbear

how does a JAR component differ from an EAR? (application server)


What's the distinction between a JAR and an EAR file relative to EJB's? Glassfish help says:

thufir@doge:~$ 
thufir@doge:~$ GlassFish_Server/bin/asadmin deploy --help

...

       --type
           The packaging archive type of the component that is being deployed.
           Possible values are as follows:

           car
               The component is packaged as a CAR file.

           ear
               The component is packaged as an EAR file.

           ejb
               The component is an EJB packaged as a JAR file.

           osgi
               The component is packaged as an OSGi bundle.

           rar
               The component is packaged as a RAR file.

           war
               The component is packaged as a WAR file.

So an EJB can be packaged as a JAR file? What is the functional difference? Specifically, what can an EAR component do which a JAR cannot?


Solution

  • EAR - Ear files are basically intended to contain complete enterprise applications. it contains all of the components that make up a particular Java EE application. The enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web applications

    JAR - Java Archives (JAR) A JAR file encapsulates one or more Java classes, a manifest, and a descriptor. Jar files are basically intended to hold generic libraries of Java classes, resources etc. Also, the JAR files are the lowest level of archive. JAR files are used in Java EE for packaging EJBs and client-side Java Applications.