Execution failed for task ':app:compileDebugJavaWithJavac'

I’m getting an error regarding the compile whenever I try to run. The specific error I get is:

java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x7f42062b) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x7f42062b

I have attached a screen shot of my bash profile showing where my JAVA_HOME is set. I have searched through the help forum seeing if anyone else has had this issue, github and stack overflow but no avail.