Java 9中的Multi-Release jar(mrjar)是什么?

这个mrjar可以扩展一个jar文件的已有目录结构。它包含一个根目录,其中包含了所有的内容,以及一个META-INF目录,用于存储关于该jar文件的元数据。通常,一个jar文件包含一个META-INF/MANIFEST.MF文件,其中包含了属性。

jar文件中的条目如下:

<strong>- jar-root
- C1.class
- C2.class
- C3.class
- C4.class
- META-INF
- MANIFEST.MF</strong>

In the above template, the jar contains four class files and a MANIFEST.MF file. The mrjar extends the META-INF directory to store classes that can be specific to the Jdk version. The META-INF directory contains version sub-directory that contains many sub-directories, each of them named the same as Jdk major version. For instance, the classes specific to Jdk 9, there is a META-INF/versions/9 directory. For classes specific to Jdk 10, there is META-INF/versions/10.

<strong>- jar-root
 - C1.class
 - C2.class
 - C3.class
 - C4.class
- META-INF
 - MANIFEST.MF
 - versions
 - 9
  - C2.class
  - C5.class
 - 10
  - C1.class
  - C2.class
  - C6.class</strong>

以上就是Java 9中的Multi-Release jar(mrjar)是什么?的详细内容,更多请关注其它相关文章!