5

i have a exceptionlike java.lang.reflect.InaccessibleObjectException: Unable to make jdk.internal.loader.ClassLoaders$AppClassLoader(jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.URLClassPath) accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @45f08579
after i use a library compile group: 'com.github.snowindy', name:'scriptlet4docx', version: '0.8.6'

i found some solution like
1. java --add-opens java.base/java.lang=ALL-UNNAMED from here How to solve InaccessibleObjectException ("Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}") on Java 9?
2. java --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED -jar scriptlet4docx-0.8.6.jar

so i tried to run this commande in my terminal, but it doesn't work. and also i tried add vm option like enter image description here

or here enter image description here but both of them don't work...

I used the default version of jdk in intellij jdk11.

broaden vi
  • 131
  • 1
  • 1
  • 5
  • In your case the library is named : ```If the reflecting code is in a named module, ALL-UNNAMED can be replaced by its name.``` – IQbrod May 07 '20 at 16:57

1 Answers1

7

In fact the post solution says that you have to make a mirror with the jvm of the blow the option of jvm is not in intellij but in gradle.

so i add this code in build.gradle and then it works

tasks.withType(JavaExec) {
    jvmArgs += ['--add-opens', 'java.base/jdk.internal.loader=ALL-UNNAMED']
}
broaden vi
  • 131
  • 1
  • 1
  • 5