How to Solve ‘Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”’

When working with Java, you may have encountered many errors. But still, java is an important part of the programming world. Programmers learn this language to rule the programming world with exceptionally coded programs. When you are in the phase of learning, you may get ‘Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”’ warning shows up after compiling the program.

Beginners should not need to worry as they have not done anything wrong to get the error warning. As you are here to get the issue fixed, we are going to provide you with an exceptional solution that can help you get rid of the error. First, check out how error occurs

How Error Occurs

The main cause of the error is a Java update from version 11 to 17. Sometimes, the new update comes up with some new features and configuration settings that you are not used to, and that’s the reason you get worried when you see the error warning pop up. When you update the version, you get the error after coding$MapMaker$StrategyImpl.compute( … 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
14:18:48 INFO [org.schemarepo.server.RepositoryServer ] Routing java.util.logging traffic through SLF4J Exception in thread “main”$ComputationException: java.lang.ExceptionInInitializerError at$MapMaker$StrategyImpl.compute( at$MapMaker$StrategyImpl.compute(

Now that you have seen how you can get the error. It’s time to fix the error warning.

Solutions To fix Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”

There are a few solutions that are really effective when it comes to solving this error. Check out the solutions

Using VM Parameter

When you upgrade the Java version from 11 to 17, you need to add a parameter at the time of launch.

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

In Java version 17, the -illegal-access becomes ineffective with all the values set on the verge to equivalent to denying. It is still possible for you to use the option -add-opens command-le or the JAR-file Add-open to make specific packages open.

This can solve the error warning in an efficient way.

Include -illegal-access=warn

To get the error warning fixed, you need to include the -illegal-access=warn in your code.

–illegal-access=warn and –add-opens java.base/java.lang=ALL-UNNAMED

You need to add this to your eclipse.ini.

This is the method that can help you solve the ‘Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”’ warning.


We have highlighted the solutions to fix ‘Error: “java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class”’. Two solutions are discussed, and it is completely on you to choose either according to the projects and errors. Both solutions are perfect to solve the error exception.

On that note, I wish you luck! Hope you find it helpful!

Your feedback is valuable for us so feel free to share your issues and even drop a message if it solves your issue!

Leave a Reply

Your email address will not be published. Required fields are marked *