1

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?

assylias
  • 321,522
  • 82
  • 660
  • 783

1 Answers1

3

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"/>
assylias
  • 321,522
  • 82
  • 660
  • 783
  • It still works with Java 16, I use it to make EasyMock work but I'm not sure it still works with Java 17 because of strong encapsulation. – gouessej Sep 03 '21 at 11:37