 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we create a multi-release jar(mrjar) using jar tool in Java 9?
In Java 9, a new feature "multi-release jar format" has been introduced where jar format enhanced with different versions of Java class or resources that can be maintained and used as per the platform. A jar command can be used to create a multi-release jar that contains two versions of the same class compiled for both Java 8 and Java 9 versions with a warning message, telling that both classes are identical.
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
The " --release 9" option can tell jar to include everything that can follow (the demo package inside "sampleproject-9 "directory) inside a versioned entry in the MRJAR under "root/META-INF/versions/9".
jar root - demo - SampleClass.class - META-INF - versions - 9 - demo - SampleClass.class
Advertisements
 