包javax.jnlp在模块java.jnlp中声明,它不在模块图中 [英] package javax.jnlp is declared in module java.jnlp, which is not in the module graph
问题描述
我有一个使用Java webstart技术的项目。我决定将Java版本从8升级到9.但是,我在编译时面临以下错误:
I have a project that uses Java webstart technology. I decided to upgrade the Java version from 8 to 9. However, I faced the following error on compiling:
error: package javax.jnlp is not visible
import javax.jnlp.DownloadServiceListener;
^
(package javax.jnlp is declared in module java.jnlp, which is not in the module graph)
我试图在 C:\Program Files \Java \ _jdk-9 \ lib \ java.jar
中加入classpath,但仍然存在相同的问题。
I tried to include C:\Program Files\Java\jdk-9\lib\javaws.jar
to the classpath, but still the same issue remains.
推荐答案
看起来 java.jnlp 未解决默认情况下,类路径上的代码(很像 Java EE模块)。解决方案是使用 - add-modules java.jnlp
显式添加它( javac
和 java
接受该参数)。
It looks like java.jnlp is not resolved by default for code on the class path (much like Java EE modules). The solution is to add it explicitly with --add-modules java.jnlp
(both javac
and java
accepts that parameter).
此选项在 JEP 261:模块系统 或这篇博客文章。
这篇关于包javax.jnlp在模块java.jnlp中声明,它不在模块图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!