Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6927831

invokedynamic throws NoClassDefFoundError for classes loaded by application class loader

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      InvokeDynamic throws NoClassDefFoundError in the following test:

          package test;

          import java.dyn.InvokeDynamic;
          import java.dyn.InvokeDynamicBootstrapError;

          public class Self {
            public static void main(String[] args) {
                  try {
                      InvokeDynamic.<void>greet(new Self());
                  } catch ( InvokeDynamicBootstrapError e ) {
                      System.out.println("TEST PASSED");
                  } catch ( Throwable t ) {
                      System.err.println("Oops!");
                      t.printStackTrace();
                  }
              }
          }


      ...when it is launched with -classpath:

      $ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -classpath bin test.Self
      Oops!
      java.lang.NoClassDefFoundError: test/Self
              at test.Self.main(Self.java:10)

      If we replace -classpath with -Xbootclasspath:

      $ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -Xbootclasspath/a:bin test.Self
      TEST PASSED

        Attachments

          Activity

            People

            • Assignee:
              jrose John Rose
              Reporter:
              kshiroko Kirill Shirokov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: