NoClassDefFoundError

Helmut Eller eller.helmut at gmail.com
Fri Jan 8 00:19:40 PST 2010


I built a JVM as described on the Wiki[1] and running this example:

class Foo {
    public static void main (String[] args) throws Throwable {
        java.dyn.InvokeDynamic.<java.math.BigInteger>bar();
    }
}

with java -Xint -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic Foo
prints:

Exception in thread "main" java.dyn.InvokeDynamicBootstrapError: class has no bootstrap method: class Foo
        at sun.dyn.CallSiteImpl.makeSite(CallSiteImpl.java:80)
        at Foo.main(Foo.java:4)

That's expected.  But after changing BigInteger to Foo like so:

class Foo {
    public static void main (String[] args) throws Throwable {
        java.dyn.InvokeDynamic.<Foo>bar();
    }
}

the error is different:

Exception in thread "main" java.lang.NoClassDefFoundError: Foo
        at Foo.main(Foo.java:4)

Actually, it doesn't seem possible to replace BigInteger with any of my
own classes.  Is this a bug or intended?

Helmut

[1] http://wikis.sun.com/display/mlvm/Building



More information about the mlvm-dev mailing list