Tutorial by Examples

By setting Multi-Release: true in the MANIFEST.MF file, the Jar file becomes a multi-release Jar and the Java runtime (as long as it supports the MRJAR format) will pick the appropriate versions of classes depending on the current major version. The structure of such a Jar is the following: jar ro...
The jar command can be used to create a multi-release Jar containing two versions of the same class compiled for both Java 8 and Java 9, albeit with a warning telling that the classes are identical: C:\Users\manouti>jar --create --file MR.jar -C sampleproject-base demo --release 9 -C sampleproje...
Given the following multi-release Jar: jar root - demo - SampleClass.class - META-INF - versions - 9 - demo - SampleClass.class The following class prints the URL of the SampleClass: package demo; import java.net.URL; public class Main...

Page 1 of 1