RuntimeException: Package jdk.internal.jimage.decompressor in module jrt.fs and module java.base

后端 未结 9 1688
醉酒成梦
醉酒成梦 2020-12-11 05:30

Component Details - Using IntelliJ IDEA 2017.1 CE and jdk-9-ea+154

main() -

Set se         


        
相关标签:
9条回答
  • 2020-12-11 05:42

    In Eclipse, changing the Eclipse workspace or deleting the .metadata folder in the workspace folder worked for me.

    I don’t know what fixed it, but if I had to guess it could be something in the .metadata folder that caused the exception.

    0 讨论(0)
  • 2020-12-11 05:46

    $JAVA_HOME/lib/jrt-fs.jar contains a copy of the "jrt" file system provider compiled to JDK 8. It's for tools such as IDEs that run on JDK 8 but need to access a JDK 9 run-time image.

    From the exception then it does appear that this JAR file, or maybe $JAVA_HOME/lib, has been put on the module path in error. JAR files that do no contain a module-info.class in the top-level directory are treated as automatic modules so this is why the exception has "module jrt.fs" in the message. The exception basically just means that you've ended up with two modules containing the jdk.internal.jimage.decompressor package (and many other packages) due to putting jrt-fs.jar on the module path.

    0 讨论(0)
  • 2020-12-11 05:50

    Try to remove jrt-fs.jar from the directory of jdk9. I did it in Project Structure in IntelliJ IDEA and it works fine for me

    0 讨论(0)
  • 2020-12-11 05:50

    I had the same issue on a Mac Eclipse Version: 2020-09 (4.17.0)

    Whenever I tried to run my existing Configuration I got that error. I tried all kinds of workarounds but nothing worked.

    So I created a new Configuration:

    1. Open file containing main() method.
    2. From Run menu select "Run As >> Java Application"

    That ran OK. The advantage of this is that it does not modify your JDK installation.

    0 讨论(0)
  • 2020-12-11 05:51

    I got the same error under Arch Linux. The package java-openjfx installs its libraries into the lib directory of the openjdk, which seems to cause problems. I found a workaround by adding not the whole lib directory but only the needed libraries instead.

    In project structure > Libraries > + > Java > /usr/lib/jvm/default/lib > select needed libraries (holding ctrl) should look something like this

    Then in Run Configurations set the VM Options accordingly

        --module-path /usr/lib/jvm/java-14-openjdk/lib/javafx.base.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.controls.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.graphics.jar --add-modules=javafx.controls
    

    For my project it was enough to only add controls as module but the path to base and graphics were required to get it to run.

    0 讨论(0)
  • 2020-12-11 05:53

    I had the same issue on Manjaro Linux, while it was working fine on windows. Looking at the differences it became clear that the javafx 11 package installs into /lib/jvm/java-11-openjdk/lib, which I then set as PATH_TO_FX. This seems to be the issue, because jrt-fs.jar is in the same folder.

    I moved all files from fx to a separate folder and then set that as PATH_TO_FX. Now it works fine.

    0 讨论(0)
提交回复
热议问题