RuntimeException:在模块 jrt.fs 和模块 java.base 中打包 jdk.internal.jimage.decompressor [英] RuntimeException: Package jdk.internal.jimage.decompressor in module jrt.fs and module java.base

查看:36
本文介绍了RuntimeException:在模块 jrt.fs 和模块 java.base 中打包 jdk.internal.jimage.decompressor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

组件详细信息 - 使用 IntelliJ IDEA 2017.1 CEjdk-9-ea+154

main() -

Set<String> set2 = Set.of("a", "b", "c");
set2.forEach(System.out::println);

module-info.java

module collection {
    requires java.base;
}

日志 -

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)

怀疑初始化VM的实现,我的问题是我没有包含模块jrt.fs - 它来自哪里?如何调试此类模块的包含/排除?如何进一步解决当前异常?

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?

推荐答案

$JAVA_HOME/lib/jrt-fs.jar 包含编译到 JDK 8 的jrt"文件系统提供程序的副本.它用于诸如 IDE 之类的工具在 JDK 8 上运行,但需要访问 JDK 9 运行时映像.

$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.

从异常看来,这个 JAR 文件,或者可能是 $JAVA_HOME/lib,已经错误地放在模块路径上.顶级目录中不包含 module-info.class 的 JAR 文件被视为自动模块,因此这就是异常消息中包含module jrt.fs"的原因.异常基本上只是意味着由于将 jrt-fs.jar 放在模块路径上,您最终得到了两个包含 jdk.internal.jimage.decompressor 包(以及许多其他包)的模块.

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.

这篇关于RuntimeException:在模块 jrt.fs 和模块 java.base 中打包 jdk.internal.jimage.decompressor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆