Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:JAR

From ReverseEngineering.wiki
Format
Developer Sun / Oracle
Magic 50 4B 03 04 (ZIP)
Extensions .jar, .war, .ear, .aar (Android), .jmod uses a different header
Endianness little (ZIP)
License OpenJDK GPL-2.0 with Classpath exception
On this wiki Facts · Code · Notes · Topics

Java archive: a ZIP file holding .class files, resources and a META-INF/MANIFEST.MF whose Main-Class attribute names the entry point; signed JARs add META-INF/*.SF and *.RSA/*.DSA/*.EC files, and multi-release JARs keep newer class versions in META-INF/versions/N/.

Identification

A JAR is a plain ZIP file (PK\3\4). Its signature is the manifest entry META-INF/MANIFEST.MF, usually the first entry, a text file of Name: value lines grouped into sections separated by blank lines. Lines are limited to 72 bytes; a continuation line starts with one space.

Manifest attributes seen in the OpenJDK sources

The class java.util.jar.Attributes predefines: Manifest-Version, Signature-Version, Content-Type, Class-Path (space-separated relative URLs), Main-Class (entry point for java -jar), Sealed, Extension-List, Extension-Name, Extension-Installation, Implementation-Title/-Version/-Vendor/-Vendor-Id/-URL, Specification-Title/-Version/-Vendor and Multi-Release. Launcher-related names also recognised include Add-Exports, Add-Opens, Enable-Native-Access, Launcher-Agent-Class and JavaFX-Application-Class. Per-entry sections start with Name: path and carry digest attributes (SHA-256-Digest and so on) in signed JARs. Created-By and Build-Jdk-Spec reveal the tool and JDK that built the file.

Multi-release JARs

With Multi-Release: true in the main section, META-INF/versions/N/ (N 9 or higher) overrides entries for runtimes of feature release N or newer. A decompiler that ignores this reads the old classes. Class files under versions/ have their own major version (Format:Java class file).

Signatures

Signed JARs hold META-INF/<NAME>.SF (digests of manifest sections) and a PKCS#7 block META-INF/<NAME>.RSA, .DSA or .EC. Checked in OpenJDK sun/security/util/SignatureFileVerifier.java (openjdk/jdk @ 3104115c2a): a signature-related entry is recognised by the suffixes .SF, .DSA, .RSA or .EC. Unverified: the digest and signing details beyond these names were not read.

Related

Android APKs are also ZIPs with a manifest in META-INF but hold Format:DEX code (Format:APK). Spring Boot style fat JARs nest JARs under BOOT-INF/lib/ and use a custom launcher in Main-Class (Unverified: not read from a source here).

See also

Code & repositories

  • https://github.com/openjdk/jdk @ 3104115c2a0587895997965c9e88a1181f52ee47 · license: GPL-2.0-only WITH Classpath-exception-2.0 (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
    OpenJDK: classFileParser.cpp (class parsing), classfile_constants.h.template (tags, access flags), ClassFileFormatVersion.java (major versions), libjimage/imageFile.hpp (jimage layout), JmodFile.java, JarFile.java and Attributes.java (manifest names).
    Tested on: source read, not run: Read at this commit (October 2026); files fetched, not built. · checked 2026-10-18; last activity 2026-10-18