Search code examples
javajava-web-startjnlpjava-9

Passing --add-opens argument to Java webstart


I'm running an application using Java Webstart but it requires opening a module when run with Java 9+:

java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @207bb528

How do I need to modify my jnlp to make it work?


Solution

  • With java, you would use, for example:

    java --add-opens java.base/java.lang=ALL-UNNAMED
    

    In a JNLP file, you would do the same but need to replace the space with a "=", for example:

    <j2se version="1.8.0_45+" java-vm-args="--add-opens=java.base/java.lang=ALL-UNNAMED"/>