简体   繁体   中英

java.lang.reflect.inaccessibleobjectexception unable to make jdk.internal.loader.classloaders

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.

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']
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM