JAR Files

  • Java Archive (JAR)
  • Deploys a set of classes and their resources
  • Indicates which of the components are Java Beans.
  • Elements in a JAR file can be compressed.
  • Digital signatures can be associated with individual elements in a JAR file.

Manifest file

Manifest-Version: <version> 

Name: <filename>
Name: <bean-filename>
Java-Bean: True
  • META-INF/MANIFEST.MF
  • The manifest file must be in the directory "META-INF" in the JAR file, and it must have the filename "MANIFEST.MF" (all-uppercase letters for the name of the directory and the file).
  • Java-bean entries are followed by the line "Java-Bean: True".
Manifest-Version: 1.0

Name: bean1.class
Java-Bean: True
Name: misc_file.class
Name: data.ser

EJB deployment descriptor

  • META-INF/ejb-jar.xml

jar command-line utility

jar -{cu}[vfmOMi] [jar-file] [manifest-file] [-C dir] <files>

-c Create new archive
-u Update existing archive

-v Verbose info displayed
-f Specify archive file name
-m Specify manifest file name
-O Don't compress the files
-M Don't create a manifest file
-i Generate index info

-C Change to the specified directory and include the following file
jar -cf   jarfile.jar file.class data.ser
jar -uf jarfile.jar data.ser