How to pass the Java 9 '--permit-illegal-access' flag to a Webstart application?
Asked Answered
T

2

8

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>

does not work. I get the same InaccessibleObjectException with module java.base does not "opens java.util" to unnamed module as without the flag.

Adding <j2se java-vm-args="--permit-illegal-access" version="9*"/> to the JNLP does not help.

Does Webstart support the --permit-illegal-access flag?

Can I furthermore specify the flag in the JNLP file?

Btw, with Java 9

javaws https://docs.oracle.com/javase/tutorialJWS/samples/deployment/NotepadJWSProject/Notepad.jnlp

throws an IllegalAccessException and -J--permit-illegal-access doesn't help either.

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.

Trinhtrini answered 3/4, 2017 at 9:13 Comment(2)
Does this help? #3495287 #1396926 #40933030 #22959342Fidelia
Adding <j2se java-vm-args="--permit-illegal-access" version="9*"/> to the JNLP does not work. Setting the env variable JAVA_TOOL_OPTIONS to --permit-illegal-access does work, but is not a solution since the clients are not accessible. The same holds for the deployment settings on the client computer.Trinhtrini
C
10

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.

Conjugated answered 4/4, 2017 at 8:4 Comment(1)
Works for me with the proper syntax as described in [JDK-8172986] (bugs.openjdk.java.net/browse/JDK-8172986) java-vm-args="--add-opens=java.base/java.util=ALL-UNNAMED --add-exports=java.desktop/sun.awt=ALL-UNNAMED". Thank you!Trinhtrini
S
0

This worked for me. Add the following flag to vm argument:

java --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED -jar mySpringBootApp.jar
Sandstorm answered 11/8, 2021 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.