---
# System prepended metadata

title: How to fix that testing exception
tags: [Documents-Summer21]

---

# How to fix that testing exception

###### tags: `Documents-Summer21`

Are you trying to write your tests and getting this spooky red cryptic message:

```
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at tester.Tester.runAnyTests(Tester.java:180)
	at tester.Tester.run(Tester.java:2390)
	at sol.Homework#TestSuite.main(Homework#TestSuite.java:87)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not "opens java.lang" to unnamed module @f6f4d33
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
	at tester.Reflector.getFields(Reflector.java:176)
	at tester.Reflector.<init>(Reflector.java:47)
	at tester.Inspector.isSamePrivate(Inspector.java:208)
	at tester.Inspector.isSame(Inspector.java:88)
	at tester.Tester.checkExpect(Tester.java:392)
	at tester.Tester.checkExpect(Tester.java:378)
	at sol.Homework#TestSuite.testSomething(Homework#TestSuite.java:36)
	... 7 more
```

Turns out, the newly released Java 16 messes up our `tester.jar` (you can even find your error message in the [release issues/notes](https://www.oracle.com/java/technologies/javase/16-relnotes.html) for Java 16 and the bug report [here](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8159746))

To fix this, we should use a different version of Java --- any version should be fine, as long as it doesn't say "version 16.0.1" beside it!!

## Installing a different Java version

1. Go to the menu `File > Project Structure` and select `Project` from the left sidebar, which should bring you to a window like this:
![](https://i.imgur.com/bG2b6JA.png)

2. Click on the dropdown menu for **Project SDK** and see what options are available. 

    * If there are any that do NOT say `version 16.0.1`, select one of them.
    * Otherwise, click `Add SDK > Download JDK...` and choose any version that does not say `version 16.0.1` in small letters next to it. I personally use 1.8, but it shouldn't matter.
    
    *Adding an SDK*
    ![](https://i.imgur.com/gbgke65.png)
    
    *Note how the one chosen says 1.8.0_292 in small letters, NOT version 16.0.1!!*
![](https://i.imgur.com/ay7mxdO.png)


3.  Make sure you change the **Project language level** (dropdown right under the Project SDK) to match the Project SDK (note that language level 8 matches with SDK 1.8)

4. Select `Modules` from the left sidebar and change your Module SDK to match the one selected earlier!
![](https://i.imgur.com/AaJfzfW.png)


And you're done! Hopefully everything runs now, but if not, feel free to make a post on Ed to let us know and we can get your problem fixed :D



---
*Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CS18 document by filling out the (mostly) [anonymous feedback form](https://cs.brown.edu/courses/cs018/feedback)!*