RuntimeException:在模块 jrt.fs 和模块 java.base 中打包 jdk.internal.jimage.decompressor
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42986287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RuntimeException: Package jdk.internal.jimage.decompressor in module jrt.fs and module java.base
提问by Naman
Component Details- Using IntelliJ IDEA 2017.1 CEand jdk-9-ea+154
组件详细信息- 使用IntelliJ IDEA 2017.1 CE和jdk-9-ea+154
main()-
主要()-
Set<String> set2 = Set.of("a", "b", "c");
set2.forEach(System.out::println);
module-info.java
模块信息.java
module collection {
requires java.base;
}
Logs-
日志-
Error occurred during initialization of VM
java.lang.RuntimeException: Package jdk.internal.jimage.decompressor in both module jrt.fs and module java.base
at jdk.internal.module.ModuleBootstrap.fail(java.base@9-ea/ModuleBootstrap.java:699)
at jdk.internal.module.ModuleBootstrap.boot(java.base@9-ea/ModuleBootstrap.java:329)
at java.lang.System.initPhase2(java.base@9-ea/System.java:1928)
Doubtful over the implementation of initialization of VM, my question is that I haven't included module jrt.fs
- Where is it coming in the picture from? How do I debug such modules inclusion/exclusion? How do I further solve the current exception?
怀疑VM 初始化的实现,我的问题是我没有包含模块jrt.fs
- 它从哪里来的图片?如何调试此类模块的包含/排除?如何进一步解决当前的异常?
采纳答案by Alan Bateman
$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.
$JAVA_HOME/lib/jrt-fs.jar 包含编译到 JDK 8 的“jrt”文件系统提供程序的副本。它适用于在 JDK 8 上运行但需要访问 JDK 9 运行时映像的 IDE 等工具。
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.
从异常看来,这个 JAR 文件,或者可能是 $JAVA_HOME/lib,已经错误地放在模块路径上。顶级目录中不包含 module-info.class 的 JAR 文件被视为自动模块,因此这就是异常消息中包含“module jrt.fs”的原因。异常基本上只是意味着由于将 jrt-fs.jar 放在模块路径上,您最终得到了两个包含 jdk.internal.jimage.decompressor 包(以及许多其他包)的模块。
回答by Gunnar Bernstein
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.
我在 Manjaro Linux 上遇到了同样的问题,而它在 Windows 上运行良好。查看差异后,很明显 javafx 11 包安装到 /lib/jvm/java-11-openjdk/lib 中,然后我将其设置为 PATH_TO_FX。这似乎是问题所在,因为 jrt-fs.jar 位于同一文件夹中。
I moved all files from fx to a separate folder and then set that as PATH_TO_FX. Now it works fine.
我将所有文件从 fx 移动到一个单独的文件夹,然后将其设置为 PATH_TO_FX。现在它工作正常。
回答by Aliaksandr Kot
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
尝试将 jrt-fs.jar 从 jdk9 目录中删除。我在 IntelliJ IDEA 的项目结构中做到了,它对我来说很好用
回答by abstractME
I faced this issue for Spring Toolsuite 4, The metadata contains info about the present projects in the workspace, and common eclipse settings like font, codestyle, run configurations settings and sometimes information about modules used, eclipse plugins & eclipse log file for eclipse log errors, etc.
我在 Spring Toolsuite 4 中遇到了这个问题,元数据包含有关工作区中当前项目的信息,以及常见的 eclipse 设置,如字体、代码样式、运行配置设置,有时还有有关所用模块的信息、eclipse 插件和 eclipse 日志文件的 eclipse 日志错误, 等等。
It does not contain valuable project info.
它不包含有价值的项目信息。
If this folder is deleted or changed manually, eclipse sees this directory as a new fresh workspace. You have to import the existing projects again and you are done.
如果手动删除或更改此文件夹,eclipse 会将此目录视为新的新工作区。您必须再次导入现有项目并完成。
If you want to keep your fonts, codestyle etc you can export / import these preferences for new workspaces or create a backup of .metadata.
如果您想保留您的字体、代码样式等,您可以为新工作区导出/导入这些首选项或创建 .metadata 的备份。
In my case it worked for above issue of Package jdk.internal.jimage.decompressor in module jrt.fs and module java.basewhen i deleted .metadatafolder, import project again, setup run configuration and everything started working.
在我的情况下,它适用于模块 jrt.fs 和模块 java.base 中的包 jdk.internal.jimage.decompressor 的上述问题,当我删除.metadata文件夹时,再次导入项目,设置运行配置,一切都开始工作。
回答by p-p-j
In Eclipse, changing the Eclipse workspace or deleting the .metadata folder in the workspace folder worked for me.
在 Eclipse 中,更改 Eclipse 工作区或删除工作区文件夹中的 .metadata 文件夹对我有用。
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.
我不知道是什么修复了它,但如果我不得不猜测它可能是 .metadata 文件夹中的某些内容导致了异常。
回答by Eric
remove the .metadata folder, then restart eclipse.
删除 .metadata 文件夹,然后重新启动 eclipse。