File type:
Java Archive (a compressed file for applets and related files)
| File Extension: JAR |
File type:
Java Archive (a compressed file for applets and related files)
| 5min Related Video: JAR |
| Wikipedia: JAR (file format) |
| This article's introduction section may not adequately summarize its contents. To comply with Wikipedia's lead section guidelines, please consider expanding the lead to provide an accessible overview of the article's key points. (May 2009) |
|
|
This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2008) |
![]() |
|
| Filename extension | .jar |
|---|---|
| Internet media type | application/java-archive |
| Uniform Type Identifier | com.sun.java-archive |
| Developed by | Sun Microsystems |
| Type of format | file archive, data compression |
| Extended from | ZIP |
In computing, a JAR file (or Java ARchive) aggregates many files into one. Software developers generally use .jar files to distribute Java classes and associated metadata.
Contents |
JAR files build on the ZIP file format. Computer users can create or extract JAR files using the jar command that comes with the JDK. They can also use zip tools.
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.
Developers can obfuscate JAR files so that a user of the JAR file doesn't get much information regarding the code it contains, or to reduce its size, which is useful in mobile phone applications.
Microsoft Windows users who prefer having Windows EXE files can use tools such as JSmooth, Launch4J, WinRun4J or NSIS - Java Launcher with automatic JRE installation to wrap JAR files into executables. Eclipse uses a small EXE launcher (eclipse.exe) to display the splash screen on startup and launch the application from the main JAR (startup.jar).
The Apache Ant build tool has its own package to read and write Zip and JAR archives, including support for the Unix filesystem extensions. The org.apache.tools.zip package is released under the Apache Software Foundation license and is designed to be usable outside Ant. This code is fast, widely used, and creates most JAR files that are not created with Sun's utility.[citation needed]
The Ant team found that most of their support calls related to JAR file creation have two underlying causes.
The first relates to manifest creation, specifically how long lines in the manifest are wrapped. This is a complex and somewhat ambiguous part of the specification. Ant wraps long lines at 70 characters and continues on the following line with a space at the front to indicate a continuation. This is viewed as erroneous by people who have not read the specification in detail and believe that the value of the classpath attribute should be split at a file boundary, instead of partly across a file name. Unfortunately, if that is done, the Java runtime does not detect a split line as the first line ends before the 70 character boundary.
The second is WinZip converting how file and directory names are viewed so that all uppercase names do not appear as such. When set with the default configuration older versions of WinZip (11.1 and earlier) will display all upper case names with only the first letter being uppercase (i.e. Manifest/Manifest.mf). The configuration option "Allow all uppercase filenames" can be checked in the View tab of the Configuration dialog in these versions to remedy the situation. WinZip versions later than 11.1 have this option checked by default.
Some mobile phone Java runtimes appear to parse the manifest in ways that are incompatible with the specification, and require a strict ordering of entries in the manifest. They also do not implement the line wrapping algorithm correctly. This may imply a problem in the test-suite for the Java ME mobile Java runtime.
Several related file formats build on the JAR format:
|
|||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)
| Shopping: JAR |
| jug (in archaeology) | |
| jar-owl | |
| flask (in archaeology) |
| Why was Jar Jar Binks Banished? Read answer... | |
| Is Jar-Jar-Binks A Gungan? Read answer... | |
| Is jar-jar binks a girl? Read answer... |
| How many times does the word jar or jars appear in christmas jars reunion? | |
| What does an candle jar do? | |
| What is the antonym for jar? |
Copyrights:
![]() | File Extension. © 1999-2009 by Answers Corporation. All rights reserved. Read more | |
![]() | Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "JAR (file format)". Read more |
Mentioned in