FANDOM


JAR
Blank

Filename extension .jar
Internet media type application/java-archive
Uniform type identifier com.sun.java-archive
Developed by Sun Microsystems
Extended from ZIP
Type Archive format
data compression
Opens with [[Program::Java virtual machine]]
File formats category - v  e   edit
Smallwikipedialogo.png Wikipedia has an article related to:

A JAR file (Java archive) is a ZIP file that contains files that together can be executed by the Java VM.

OverviewEdit

JAR files build on the ZIP file format. A JAR file has an optional manifest file located in the path META-INF/MANIFEST.MF. The entries in the manifest file determine how one can use the JAR file. JAR files 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

Users can typically start such JAR files with a command similar to:

java -jar foo.jar

These files can also include a Classpath entry, which identifies other JAR files for loading with the JAR. This entry consists of a list of absolute or relative paths to other JAR files. Although intended to simplify JAR use, in practice it turns out to be notoriously brittle, as it depends on all the relevant JARs being in the exact locations specified when the entry-point JAR was built. To change versions or locations of libraries, a new manifest is needed.

Developers can digitally sign JAR files. In that case, the signature information becomes part of the manifest file. The JAR itself is not signed, but instead every file inside the archive is listed along with its checksum; it is these checksums that are signed. Multiple entities may sign the JAR file, changing the JAR file itself with each signing, although the signed files themselves remain valid. When the Java runtime loads signed JAR files, it can validate the signatures and refuse to load classes that do not match the signature. It can also support 'sealed' packages, in which the Classloader will only permit Java classes to be loaded into the same package if they are all signed by the same entities. This prevents malicious code from being inserted into an existing package, and so gaining access to package-scoped classes and data.

Related formats Edit

Several related file formats build on the JAR format:

  • WAR (Web Application Archive) files, also Java archives, store XML files, Java classes, JavaServer Pages and other objects for Web Applications.
  • EAR (Enterprise Archive) files provide composite Java archives which combine XML files, Java classes and other objects including JAR, WAR and RAR Java archive files for Enterprise Applications.

External linksEdit

This page uses CC-BY-SA content from Wikipedia (authors). Smallwikipedialogo.png

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.