article

In computing, a JAR file (or Java Archive) is a ZIP file used to distribute a set of Java classes. It is used to store compiled Java classes and associated metadata that can constitute a program.

  • OpenDocument files are also Java archives which store XML files and other objects.
  • WAR (file format) (Web Application aRchive) files are also Java archives which store XML files, java classes, Java Server Pages and other objects for Web Applications.
  • EAR (file format) (Enterprise ARchive) files are also Java archives which store XML files, java classes and other objects for Enterprise Applications.
  • RAR (file format) (Resource Adapter aRchive) files are also Java archives which store XML files, java classes and other objects for J2EE Connector Architecture (JCA) connector.

JAR files can be created and extracted using the "jar" command that comes with the JDK. Alternatively it can be done using zip tools.

A JAR file has a manifest file located in the path META-INF/MANIFEST.MF. The entries in the manifest file determine how the JAR file will be used. JAR files which are intended to be executed as standalone programs will have one of their classes specified as the "main" class. The manifest file would have an entry such as

Main-Class:myPrograms.MyClass

A JAR file can be digitally signed. If so, the signature information is added to the manifest file.

Such JAR files are typically started with a command similar to

java -jar foo.jar

In JDK 1.1, the manifest file contained a list of all files contained in the JAR file.

JAR files can be obfuscated so that a user of the JAR file doesn't get much information regarding the code it contains.

GNU jar or fastjar


The GNU Project has implemented the jar command by a program written in C language. This variant claims to be much faster than the original Sun Microsystems jar program (written in Java language). GNU jar is released under GNU General Public License (GPL).

There is not much documentation around for this utility. GNU Project has this brief introduction. However, this is the jar version distributed with many Linux distributions and also with Cygwin for windows.

External links


Archive formats | Java platform

Java Archive | Java Archive | JAR | Jar | JAR | Java Archive | Java Archive | JAR | Jar | JAR | Java Archive | Java Archive | JAR | Jar | JAR | Java Archive | Java Archive | JAR | Jar | JAR

 

This article is licensed under the GNU Free Documentation License. It uses material from the "JAR (file format)".

Home Pageartsbusinesscomputersgameshealthhospitalshomekids & teensnewsphysiciansrecreationreferenceregionalscienceshoppingsocietysportsworld