Example of a multi-release JAR file's contents
suggest changeBy setting Multi-Release: true in the MANIFEST.MF file, the JAR becomes a multi-release JAR. A runtime that supports that format loads the newest class version whose directory is less than or equal to the runtime's major version.
The structure of such a Jar is the following:
jar root
- A.class
- B.class
- C.class
- D.class
- META-INF
- versions
- 9
- A.class
- B.class
- 10
- A.class
- On JDKs < 9, only the classes in the root entry are visible to the Java runtime.
- On a JDK 9, the classes A and B will be loaded from the directory
root/META-INF/versions/9, while C and D will be loaded from the base entry. - On a JDK 10, class A is loaded from
root/META-INF/versions/10, class B fromroot/META-INF/versions/9, and classes C and D from the root.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents