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.

Miro
  • 133
  • 2
  • 7
  • Does this help? http://stackoverflow.com/questions/3494787/enabling-jvm-options-with-java-web-start-jnlp http://stackoverflow.com/questions/1396426/passing-command-line-arguments-to-javaws-java-webstart-executable http://stackoverflow.com/questions/40932530/how-to-pass-unsafe-arguments-to-the-jvm-of-a-java-webstart-application http://stackoverflow.com/questions/22958842/how-to-pass-jvm-arguments-to-java-web-start-from-html – Jerry Jeremiah Apr 03 '17 at 09:23
  • Adding `` 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. – Miro Apr 03 '17 at 10:43

2 Answers2

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.

Alan Bateman
  • 5,283
  • 1
  • 20
  • 25
  • 5
    Works for me with the proper syntax as described in [JDK-8172986] (https://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! – Miro Apr 05 '17 at 09:06
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
blackbrandt
  • 2,010
  • 1
  • 15
  • 32
azzmi
  • 21
  • 2