InvokeDynamic throws NoClassDefFoundError

Rémi Forax forax at univ-mlv.fr
Thu Feb 18 03:22:25 PST 2010


Le 18/02/2010 10:44, Kirill Shirokov a écrit :
> John,
>
> I don't know if it is a known issue, but I noticed that 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
>
> The JDK was 7 b82.
>    

Yes, this is a known bug that exist from the beginning.

> Best regards,
> Kirill
>    

Rémi


More information about the mlvm-dev mailing list