java.lang.IllegalAccessError : class cannot access class because module does not export to unnamed module

Viewed 1234

I want to use jdk.internal.net.http.common.Pair and I am getting this error when running my project :

Caused by: java.lang.IllegalAccessError: class com.pacman.controller.SignUpMenuController (in unnamed module @0x51565ec2) cannot access class jdk.internal.net.http.common.Pair (in module java.net.http) because module java.net.http does not export jdk.internal.net.http.common to unnamed module @0x51565ec2

I looked into this question : Gradle run with `--add-exports`

and since my project is not modular what exactly should I add in my project build.gradle file?

and when I add :

run {
jvmArgs = ['--add-exports=java.net.http/jdk.internal.net.http = All-UNNAMED']}

to my desktop/build.gradle file I still get the same error.

0 Answers
Related