. Advertisement .
..3..
. Advertisement .
..4..
The error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
How To Solve The Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”?
When updating your Java version from 11 to 17, you may encounter the following problem after the upgrade.
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549) … 15 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class
Note: modules in the startup list are –add-opens java.base/java.lang=ALL-UNNAMED –add-opens java.base/java.util=ALL-UNNAMED –add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
14:18:48 INFO [org.schemarepo.server.RepositoryServer ] Routing java.util.logging traffic through SLF4J Exception in thread “main” com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553) at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
To fix this error, run java –add-opens java.base/java.lang=ALL-UNNAMED from the command line. Now, you have fixed your problem.
Approach 1: Set the VM parameter
You simply set this VM parameter during launch to solve “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”
java --add-opens java.base/java.lang=ALL-UNNAMED
Approach 2: Supplement –illegal-access=warn
Another way to fix “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class” is adding –add-opens java.base/java.lang=ALL-UNNAMED and –illegal-access=warn to your eclipse.ini.
Approach 3: Follow this process
Follow this process to solve your problem.
In the case your pop-up window continues popping up, you need to remove this first, then automatically compile as shown below:
......... ADVERTISEMENT .........
..8..

Pay attention—your eclipse.ini configuration file is the issue, not whether it’s clean or not!
You do as the online installation guide as usual, but here you need to pay attention to ”my frame is prepared”.
......... ADVERTISEMENT .........
..8..

You are being prompted to add parameters for it:
-vmargs
The Eclipse configuration file need to be opened first.
......... ADVERTISEMENT .........
..8..

The next step, you need to supplement the parameter in the final line:
......... ADVERTISEMENT .........
..8..

-vmargs -javaagent:D:\software\Eclipse\Eclipse2021\eclipse\lombok.jar
Now the problem of not compiling is solved perfectly!
......... ADVERTISEMENT .........
..8..

Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment