如何将 Java 9 '--permit-illegal-access' 标志传递给 Webstart 应用程序? [英] How to pass the Java 9 '--permit-illegal-access' flag to a Webstart application?
问题描述
通过将 --permit-illegal-access
标志传递给 VM,我让我的应用程序使用 JRE build 9-ea+163 运行.现在我想用 Java Webstart 启动应用程序.第一次尝试
I got my application running with JRE build 9-ea+163 by passing the --permit-illegal-access
flag to the VM. Now I want to start the app with Java Webstart. A first try with
javaws -J--permit-illegal-access <JNLP-Url>
不起作用.我得到相同的 InaccessibleObjectException
与 module java.base 不会像没有标志一样打开 java.util"到未命名模块
.
does not work. I get the same InaccessibleObjectException
with module java.base does not "opens java.util" to unnamed module
as without the flag.
将 <j2se java-vm-args="--permit-illegal-access" version="9*"/>
添加到 JNLP 没有帮助.
Adding <j2se java-vm-args="--permit-illegal-access" version="9*"/>
to the JNLP does not help.
Webstart 是否支持 --permit-illegal-access
标志?
Does Webstart support the --permit-illegal-access
flag?
我可以进一步在 JNLP 文件中指定标志吗?
Can I furthermore specify the flag in the JNLP file?
顺便说一句,使用 Java 9
Btw, with Java 9
javaws https://docs.oracle.com/javase/tutorialJWS/samples/deployment/NotepadJWSProject/Notepad.jnlp
抛出一个 IllegalAccessException
并且 -J--permit-illegal-access
也无济于事.
throws an IllegalAccessException
and -J--permit-illegal-access
doesn't help either.
P.S.:将环境变量 JAVA_TOOL_OPTIONS
设置为 --permit-illegal-access
有效,但不是解决方案,因为无法访问客户端.
P.S.: Setting the env variable JAVA_TOOL_OPTIONS
to --permit-illegal-access
works, but is not a solution since the clients are not accessible.
推荐答案
Java Web Start 不支持 --permit-illegal-access
选项.需要打破封装的 JNLP 应用程序应该使用精确的选项,同时支持 --add-exports
和 --add-opens
.
Java Web Start does not support the --permit-illegal-access
option. JNLP apps that need to break encapsulation should use the precise options, there is support for both --add-exports
and --add-opens
.
这篇关于如何将 Java 9 '--permit-illegal-access' 标志传递给 Webstart 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!