I am getting following error while running a test in my Project:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @XXXXXX
I am using the green run arrow next to my test method to execute the test as specified here.
Solution such as these might be helpful, but I am not sure how to pass a command line argument in this case --add-opens=java.base/java.lang=ALL-UNNAMED to be added while running the tests in a method specified above.?
Please try the menu
Run | Edit Configurations..., and click theModify optionsdrop-down, then click the checkbox menuAdd VM Options, input:--add-opens=java.base/java.lang=ALL-UNNAMEDThis should fix this problem.