About
For deployment purpose, J2EE applications are delivered and reside in Archive files (or unit).
A RAR, WAR or EAR file is a standard JAR (.jar) file with a .war or .ear extension. Each archive extension file denotes its purpose. A JAR (Java ARchive) file format is based on the standard ZIP file format with an optional manifest file.
J2EE Archive Type | File Extension | Module Type |
---|---|---|
Enterprise Archive | EAR | All modules together |
Java Archive | JAR | Enterprise Bean Module, Application Client module |
Web Archive | WAR | Web module |
Resource Adapter | RAR | Ressource Adapter module |
A J2EE archive is composed of:
- one or more modules
- and a deployment descriptor
Using modules and JAR, WAR, EAR files makes it possible to assemble a number of different J2EE applications using some of the same components. No extra coding is needed; it is just a matter of assembling various J2EE modules into Java EE JAR, WAR, or EAR files.
Management
unpack an archive
The following command will unpack the archive in the current directory
jar xvf myArchive.ear
The following command will unpack all ear archive in the current directory
jar xvf *.ear
load dynamically a JAR
See The System class contains a means of loading files and libraries with the methods (load and loadlibrary). For a class, see Java - Class (Definition)
search a jar
- See jar search
scan
- https://creadur.apache.org/tentacles/ - Apache Tentacles™ will download all the archives from a staging repo, unpack them and create a little report of what is there.
Structure and Content
EAR
An EAR file contains:
- Java EE modules
- and, optionally, deployment descriptors.
where:
- the directory META-INF contains the configuration files (deployment descriptors, manifest). META-INF is WEB-INF for a Web module.
The MANIFEST.MF files are created automatically by the JAR utility
Module
A Java EE module consists of:
- one or more Java EE components for the same container type (Ejb, Web component, …)
- and, optionally, one component deployment descriptor of that type.
A Java EE module can be deployed as a stand-alone module.
Java EE modules are of the following types:
EJB
An EJB modules contain:
- class files for enterprise beans
- and an EJB deployment descriptor.
EJB modules are packaged as JAR files with a .jar extension.
Web
Application client
Application client modules contain:
- class files
- and an application client deployment descriptor.
Application client modules are packaged as JAR files with a .jar extension.
Resource adapter
Resource adapter modules contain:
- all Java interfaces,
- classes,
- native libraries,
- and other documentation,
- along with the resource adapter deployment descriptor.
Together, these implement the Connector architecture for a particular EIS.
Resource adapter modules are packaged as JAR files with an .rar (resource adapter archive) extension.