Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139297

java.lang.NoClassDefFoundError: Could not initialize class jdk.internal.jimage.ImageNativeSubstrate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 9
    • 9
    • core-libs
    • b83
    • b88

    Backports

      Description

        Consider this test class:
        ---
        import java.net.URI;
        import java.net.URISyntaxException;
        import java.nio.file.Paths;

        public class JrtFsTest {

            public static void main(String[] args) throws URISyntaxException {
                Paths.get(new URI("jrt:/"));
            }

        }
        ---

        Compile it, and run it on JDK 8 like:
        jdk8/bin/java -classpath <JDK9-image>/jrt-fs.jar:<path-to-test> JrtFsTest

        This fails with:
        ---
        Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class jdk.internal.jimage.ImageNativeSubstrate
                at jdk.internal.jimage.BasicImageReader.openImageSubstrate(BasicImageReader.java:60)
                at jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:46)
                at jdk.internal.jimage.ImageReader.<init>(ImageReader.java:65)
                at jdk.internal.jimage.ImageReader.open(ImageReader.java:75)
                at jdk.internal.jimage.ImageReader.open(ImageReader.java:82)
                at jdk.internal.jrtfs.JrtFileSystem.openImage(JrtFileSystem.java:93)
                at jdk.internal.jrtfs.JrtFileSystem.<init>(JrtFileSystem.java:108)
                at jdk.internal.jrtfs.JrtFileSystemProvider$1.<init>(JrtFileSystemProvider.java:113)
                at jdk.internal.jrtfs.JrtFileSystemProvider.getTheFileSystem(JrtFileSystemProvider.java:113)
                at jdk.internal.jrtfs.JrtFileSystemProvider.getPath(JrtFileSystemProvider.java:102)
                at java.nio.file.Paths.get(Paths.java:143)
                at JrtFsTest.main(JrtFsTest.java:8)
        ---

        This is with jrt-fs.jar from:
        $ java -version
        java version "1.9.0-ea"
        Java(TM) SE Runtime Environment (build 1.9.0-ea-b83)
        Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b83, mixed mode)

        Running on:
        $ java -version
        java version "1.8.0_40"
        Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
        Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

        Attachments

          Issue Links

            Activity

              People

                chegar Chris Hegarty
                jlahoda Jan Lahoda
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: