Home > Java > javaTutorial > How can we create a multi-release jar (mrjar) using the jar tool in Java 9?

How can we create a multi-release jar (mrjar) using the jar tool in Java 9?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-09-16 19:21:03
forward
1197 people have browsed it

我们如何使用Java 9中的jar工具创建一个多版本发布的jar(mrjar)?

In Java 9, a new feature "Multi-version jar format" has been introduced in which different versions of Java classes can be used or maintainable resources to enhance the jar format and use it according to the platform. The jar command can be used to create a multi-version jar containing two versions of the same class compiled for Java 8 and >Java 9 Version comes with a warning message informing that the two classes are identical.

<strong>C:\Users\User\tutorialspoint>jar --create --file MR.jar -C sampleproject-base demo --release 9 -C sampleproject-9 demo
Warning: entry META-INF/versions/9/demo/SampleClass.class contains a class thatis identical to an entry already in the jar</strong>
Copy after login

" --release 9" option can tell the jar to include all the following content (the demo package in the "sampleproject-9" directory ) in "## Within the versioned entry of MRJAR under #root/META-INF/versions/9”.

<strong>jar root
   - demo
      - SampleClass.class
   - META-INF
      - versions
         - 9
            - demo
               - SampleClass.class</strong>
Copy after login

The above is the detailed content of How can we create a multi-release jar (mrjar) using the jar tool in Java 9?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template