NoClassDefFoundError: Could not initialize, class com.google.inject.internal.cglib.core.$ReflectUtils

Dawid Weiss dawid.weiss at gmail.com
Mon Sep 19 19:21:30 UTC 2016


> If you specify -XX:+IgnoreUnrecognizedVMOptions then JDK 8/older will ignore
> the JDK 9 options that it doesn't recognize.

But this only applies to -XX options, doesn't it? I can't quite use
the gnu-style options with the above because how would it know what is
an option and what is part of command line arguments?

> jdk1.9\bin\java  --add-modules jdk.xml.bind,java.activation -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+129-jigsaw-nightly-h5343-20160802)
Java HotSpot(TM) 64-Bit Server VM (build
9-ea+129-jigsaw-nightly-h5343-20160802, mixed mode)

> jdk1.8\bin\java  -XX:+IgnoreUnrecognizedVMOptions --add-modules jdk.xml.bind,java.activation -version
Error: Could not find or load main class jdk.xml.bind,java.activation

Also, we're can't really restrict our users to OpenJDK (or Oracle's
distribution):

> jdk1.8-ibm\bin\java -XX:+IgnoreUnrecognizedVMOptions --add-modules jdk.xml.bind,java.activation -version
JVMJ9VM007E Command-line option unrecognised: --add-modules
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

> In the main manifest of the main application JAR then you can put:
>
>   Add-Exports-Private: java.base/java.lang

Yup, that's more what I had in mind.

Dawid


More information about the jigsaw-dev mailing list