Format:JMOD
| Developer | Oracle / OpenJDK |
|---|---|
| Magic | 4A 4D 01 00 ("JM" 1.0) |
| Extensions | .jmod |
| Endianness | n/a (ZIP after the 4-byte prefix) |
| License | GPL-2.0 with Classpath exception |
| On this wiki | Facts · Code · Notes · Topics |
Java 9+ build-time module container (.jmod): a ZIP-like archive that starts with the 4-byte header 4A 4D 01 00 ("JM", version 1.0) and holds classes/, conf/, include/, legal/, man/, lib/ and bin/ for one module; jlink consumes them to build a runtime image.
Layout
From JmodFile.java in the OpenJDK sources: the file is a ZIP archive whose first four bytes are the magic 4A 4D ("JM"), major version 0x01 and minor 0x00, written before the ZIP data. Entries live under a section directory: classes (the module's .class files, including module-info.class), conf, include (header files), legal, man, lib (native libraries) and bin (native commands). Readers reject a different magic and a newer version than 1.0.
Because the prefix shifts the ZIP, ordinary ZIP tools may need to skip the first 4 bytes (Unverified: behaviour of specific tools). Extraction in the JDK: the jmod extract and jmod list commands (general knowledge, Unverified here).
The class files inside are ordinary Format:Java class files (module-info.class has the ACC_MODULE flag and Module attributes). The runtime form after jlink is Format:jimage; classic distribution is Format:JAR.
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