Java 9 - Multirelease JAR


This enhancement is related to how you package application classes in jar files.

Using multi-release feature, now a jar can contains different versions of a class – compatible to different JDK releases. The information regarding different versions of a class, and in which JDK version which class shall be picked up by class loaded, is stored in MANIFEST.MF file. In this case, MANIFEST.MF file includes the entry Multi-Release: true in its main section.

Steps

Step 1 − Create a folder c:/test/java7/com/javacodegeeks. Create Test.java with following content −

    package com.javacodegeeks;

public class Tester {
   public static void main(String[] args) {
      System.out.println("Inside java 7");
   }
}

Run example »





javacodegeeks is optimized for learning.© javacodegeeks .
All Right Reserved and you agree to have read and accepted our term and condition