关于报错java.lang.reflect.InaccessibleObjectException: Unable to make field private java.util.concurrent

java.lang.reflect.InaccessibleObjectException: Unable to make field private java.util.concurrent.Callable java.util.concurrent.FutureTask.callable accessible: module java.base does not "opens java.util.concurrent" to unnamed module @32eebfca

假如报这种错误,只需要在Run->Edit Configurations->Modify Options->add VM options中加 

--add-opens java.base/java.util.concurrent=ALL-UNNAMED

假如你报的是下面这种错误,就加 

--add-opens java.base/java.util.concurrent.locks=ALL-UNNAMED

java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.concurrent.locks.ReentrantLock$Sync java.util.concurrent.locks.ReentrantLock.sync accessible: module java.base does not "opens java.util.concurrent.locks" to unnamed module @4ee285c6

把报错中双引号里面内容加上即可,格式是:

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

你可能感兴趣的:(java,jvm)