简体   繁体   中英

Why am I receiving this sort of error is it due to incompatible versions of jdk and compiler?

I have a program in java in eclipse 2022-06. I had realized that the jre and compiler versions were different versions as soon as I updated both of them to 1.8 the error disappeared but somehow it has re appeared again and I don't know what could be causing this.

Is it some kind of setting or incompatibility with java versions? I would like to use Java 8 on this project.

Exception in thread "main" java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @d2cc05a
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)

Please add it to your startup

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

can solve the problem.

For details, you can refer to https://www.cnblogs.com/IcanFixIt/p/7144366.html But it is a Chinese website and you may need to translate it.

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