Issue
My project runs on the command line but fails to run in IntelliJ. I've tried all of the solutions in the following questions:
- Error: Java: invalid target release: 11 - IntelliJ IDEA
- href="https://stackoverflow.com/q/42529580/715608">Execution failed for task ':compileJava'. Gradle
- Execution failed for task ':compileJava'. > invalid source release: 1.7
However I did notice that Gradle is compiling the project with the wrong JDK
Does anyone know why InteliJ is not using the JDK I defined?
I also tried overriding JAVA_HOME
Solution
Configure IntelliJ IDEA Gradle JDK: Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM.
Answered By - CrazyCoder
Answer Checked By - Katrina (JavaFixing Volunteer)