Jar (file format)
Encyclopedia : J : JA : JAR : Jar (file format)
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.
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.MyClassA 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.jarIn 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
- [Using JAR files: The Basics (from Sun)]
- [Lesson: Packaging Programs in JAR Files (from Sun)]
- [Jar File Overview (from Sun)]
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
