URL of a loaded class inside a multi-release Jar
suggest changeGiven the following multi-release Jar:
jar root
  - demo
     - SampleClass.class
  - META-INF
     - versions
        - 9
           - demo
              - SampleClass.classThe following class prints the URL of the SampleClass:
package demo;
import java.net.URL;
public class Main {
    public static void main(String[] args) throws Exception {
        URL url = Main.class.getClassLoader().getResource("demo/SampleClass.class");
        System.out.println(url);
    }
}If the class is compiled and added on the versioned entry for Java 9 in the MRJAR, running it would result in:
C:\Users\manouti>java --class-path MR.jar demo.Main
jar:file:/C:/Users/manouti/MR.jar!/META-INF/versions/9/demo/SampleClass.class
  Found a mistake? Have a question or improvement idea?
  Let me know.
      
      Table Of Contents