javagithubartificial-intelligenceface-recognitionintellij-14

module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @4bae33a6


I cloned this Project from Github

https://github.com/PacktPublishing/Java-Machine-Learning-for-Computer-Vision.git

I am going to use the FaceRecognizition from this project. But as soon as I try to run this in IntelliJ I get this error

java: java.lang.ExceptionInInitializerError Unable to make field private com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs accessible: module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @4bae33a6

What can I do?


Solution

  • I had same issue first check what Java version is used by maven by using

    mvn -v

    if it is set to Jdk 16 then you will have to update file below

    /usr/local/Cellar/maven/{version}/bin/mvn

    and set

    JAVA_HOME:-$(/usr/libexec/java_home)

    then you can confirm by running mvn -v again

    Above steps have resolved the issue for me