What is the JAR file format?
Files with the .jar extension are ZIP archives used by the Java platform to bundle compiled .class files, metadata, and resources - such as images, text files, and configuration data - into a single portable package. The format was introduced with JDK 1.1 and remains the primary distribution unit for Java libraries and applications.
A .jar file can function as a standalone executable when its META-INF/MANIFEST.MF file specifies a Main-Class entry. When launched with java -jar file.jar, the JVM reads this attribute and starts the designated class, letting developers ship a complete application as a single file that runs on any system with a compatible runtime installed. Each individual entry inside the archive can also be compressed independently using the DEFLATE algorithm, which reduces package size while still allowing fast random access to individual files.
Among the metadata a .jar carries, the META-INF/MANIFEST.MF file is the most important: it defines how the package is used, lists classpath dependencies via Class-Path, and can contain security attributes. Digital signatures are stored as separate .SF and .DSA/.RSA files inside META-INF/, not in the manifest itself. Java 9 introduced two further features: Multi-Release JARs place version-specific class overrides under META-INF/versions/N/, and modular JARs include a module-info.class at the archive root.
To browse or extract the contents of a .jar file, you can use any standard ZIP decompression tool and perform the same actions as with a normal archive - renaming it to .zip works equally well. You can also use the jar command included with the JDK:
- List contents:
jar -tf file.jar - Extract:
jar -xf file.jar - Run (if executable):
java -jar file.jar
Related server-side archive formats include .war files for web applications and .ear files for enterprise applications, both built on the same ZIP-based structure.
Security & safety
RISK: MEDIUMA runnable JAR is a real program: with Java installed, 'java -jar' executes whatever code it contains, with your user's permissions - so an unknown JAR can carry malware (Java RATs and trojans are a known family). Treat a downloaded JAR like any .exe: run only ones from a source you trust, and be wary of unsolicited .jar attachments. Merely inspecting it as a ZIP (7-Zip) is safe; running it is the risk. A JAR can be code-signed, but a signature only proves origin, not safety.
Format details
in a nutshellPrograms that open JAR files
Technical details
deep spec| Container format | ZIP archive - shares the `PK` (`50 4B 03 04`) magic bytes at offset 0 with all standard ZIP files |
| MIME type | `application/java-archive` |
| Required internal file | `META-INF/MANIFEST.MF` - must be present; controls metadata, classpath, and executable behaviour |
| Executable JAR trigger | `Main-Class` attribute in `MANIFEST.MF`; launched with `java -jar file.jar` |
| Payload bytecode format | Compiled `.class` files containing JVM bytecode - platform-independent, not native machine code |
| Per-entry compression | DEFLATE algorithm (same as ZIP); individual entries may also be stored uncompressed for faster random access |
| Digital signatures | `.SF` signature file paired with a `.DSA` or `.RSA` key file, both stored inside `META-INF/` |
| Classpath declaration | `Class-Path` manifest attribute lists space-separated dependent JARs for runtime resolution |
| Multi-Release JAR (MR-JAR) | Java 9+; version-specific class overrides placed under `META-INF/versions/N/` so newer JVMs pick the right bytecode |
| Module descriptor (JPMS) | A modular JAR includes `module-info.class` at the archive root, enabling the Java 9+ module system |
| Package sealing | `Sealed: true` in the manifest prevents other JARs from injecting classes into the same package at runtime |
| Uber/Fat JAR | Self-contained deployment variant that embeds all dependency JARs; requires a custom class loader such as Spring Boot Loader |
| Released | 1996-1997 (JDK 1.1) |
| Open standard | Yes · royalty-free |
| Specification | docs.oracle.com |
JAR conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about JAR files.