Reputation: 1997
I am trying to change the Java version to 8
in IntelliJ. So I went to File -> Project Structure -> Project -> Selected adopt-opnejdk8
I am on Mac
Problem is when I am trying to compile the code by running ./gradle clean build
I am getting the following error.
java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x26d1564a) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x26d1564a
So in the terminal from IntelliJ I was checking the version, I ran javac --version
, it still says 17, how can I change it to make 1.8
which might ultimately fix my error?
Upvotes: 1
Views: 3136
Reputation: 401877
JDK version in the IDE Terminal is the same as in your system terminal and is not controlled by the IDE settings. If you need to change the default JDK used in the terminal, use the system environment settings and adjust the PATH
(and optionally JAVA_HOME
) environment variables instead. Then logout/login or reboot for the changes to have effect.
If you want to change the JDK only for IntelliJ IDEA Terminal and keep using Java 17 in the system terminal, you can override PATH
environment at Settings (Preferences on macOS) | Tools | Terminal | Project Settings | Environment variables.
Windows users can check this related answer for the detailed steps how to change the system default JDK.
Upvotes: 4