title: Java9 Causes ClassNotFoundException for Class in Packaged Library
body: <p>I have the following problem with Java9 using the below simple application.
  The application has the main class <strong>Main</strong>:</p>
  
  <pre><code>package app;
  
  import lib.Greeting;
  
  public class Main {
      public static void main( String[] args ) {
          System.out.println( new Greeting().hello() );
      }
  }
  </code></pre>
  
  <p>The class <strong>Greeting</strong> is the following and packaged in the separate jar library <strong>lib.jar</strong>:</p>
  
  <pre><code>package lib;
  
  public class Greeting {
      public String hello() {
          return "Hi from Greeting lib!";
      }
  }
  </code></pre>
  
  <p>The application Main and lib.jar are packaged by Eclipse to the app.jar library with the manifest file as follows:</p>
  
  <pre><code>**Manifest-Version: 1.0
  Rsrc-Class-Path: ./ lib.jar
  Class-Path: .
  Rsrc-Main-Class: app.Main
  Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader**
  </code></pre>
  
  <p>When I run this application with Java8, it works as expected:</p>
  
  <pre><code>C:\java\J9Test\libs&gt;java -jar app.jar
  Hi from Greeting lib!
  </code></pre>
  
  <p>When I run this application with Java9, the following exception is raised:</p>
  
  <pre><code>C:\orawork\java\J9Test\libs&gt;d:\jdk1.9\bin\java.exe -jar app.jar
  Exception in thread "main" java.lang.reflect.InvocationTargetException
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:564)
          at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
  Caused by: java.lang.NoClassDefFoundError: lib/Greeting
          at app.Main.main(Main.java:7)
          ... 5 more
  Caused by: java.lang.ClassNotFoundException: lib.Greeting
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
          ... 6 more
  </code></pre>
  
  <p>How to resolve this problem and run this simple app successfully with both Java8 and 9?</p>