How to change expected Java Home in Gradle project
I'm trying to build a gradle project but I'm getting the following error:
5:20:34 PM: Executing tasks 'clean compile test'...
The newly created daemon process has a different context than expected.
Java home is different.
Expecting: '/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home' but was: '/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home'.
Please configure the JDK to match the expected one.
Open JDK Settings
5:20:35 PM: Tasks execution finished 'clean compile test'.
My project SDK is set to jdk 1.8 and my gradle jvm is set to use the project jdk so I do not understand why it is trying to use the inbuilt Intellij jdk. I have tried swapping the cradle jvm to jdk 1.8 directly and using JAVA_HOME to no avail. Additionally I have invalidated caches and restarted numerous times.
Please sign in to leave a comment.
Hello,
Please try suggestions mentioned here: https://stackoverflow.com/questions/35536013/intellij-build-error-context-mismatch/37418429#37418429, https://stackoverflow.com/questions/37960949/intellij-idea-says-java-home-is-different/38212434#38212434, https://youtrack.jetbrains.com/issue/IDEABKL-7301
Thank you, these proved very helpful!
You are welcome!