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

Chris Hegarty chris.hegarty at oracle.com
Fri Oct 9 19:33:52 UTC 2015


On 9 Oct 2015, at 20:26, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> I looked more closely at this and I think it's best to handle NCDFE rather than the more general LinkageError.

Ok, I make the follow change before pushing:

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);
-        } catch (UnsatisfiedLinkError ex) {
+        } catch (UnsatisfiedLinkError | NoClassDefFoundError ex) {
             substrate = ImageJavaSubstrate.openImage(imagePath, byteOrder);
         } 

> But I hope very temporary, we need to get this code fixed so do the right thing.

I added the follow to JDK-8137017, to ensure this is not forgotten:

  jrt-fs.jar should not depend, directly or indirectly, on JDK internal
  native libraries, e.g. libjimage.

-Chris.


More information about the core-libs-dev mailing list