RFR [9] 8139297: java.lang.NoClassDefFoundError: Could not initialize class jdk.internal.jimage.ImageNativeSubstrate (original) (raw)

Chris Hegarty chris.hegarty at oracle.com
Fri Oct 9 18:59:46 UTC 2015


This is a little temporary solution to get the jrt-fs up and running again with JDK 8, until JDK-8137017 [1] can be resolved.

It is fair game for an unchecked Exception or Error thrown during class initialization to result in a NCDFE. The code in BasicImageReader should catch java.lang.LinkageError, rather than UnsatisfiedLinkError ( LinkageError is the supertype of NCDFE and UnsatisfiedLinkError ), so that it falls over the the Java implementation when libjimage is not in the runtime image.

diff --git a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java --- a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java +++ b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java @@ -58,7 +58,7 @@

     try {
         substrate = ImageNativeSubstrate.openImage(imagePath, byteOrder);

-Chris.

[1] https://bugs.openjdk.java.net/browse/JDK-8137017



More information about the core-libs-dev mailing list