
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
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
- Related Articles
- What is a Multi-Release jar(mrjar) in Java 9? \n
- What is the use of a multi-version compatible jar in Java 9?
- How to create a JAR file?
- Jar files in Java
- How to make seleinum jar file , and how to test using Selenium jar file?
- How to Open a Difficult Jar?
- How to run a JAR file through command prompt in java?
- How can we create a Service Provider interface in Java 9?
- What is a JAR file?
- How can we create an unmodifiable Set in Java 9?
- How can we create an unmodifiable List in Java 9?
- How can we create an unmodifiable Map in Java 9?\n
- How can we create an instance of VarHandle in Java 9?
- How can we create a JSON using JsonGenerator in Java?
- How to add jar as library on Android Studio?

Advertisements