6

I have a new MBP (16" 2019). Downloaded a fresh copy of IntelliJ IDEA Ultimate 2020.1.1. Used SDKMan to install Java 11-zulu and latest Gradle, 6.4. Went to File->New-Project and chose Gradle. When it loads, I get a Sync error and gradle won't process in IntelliJ correctly. Everything works fine from the CLI. I tried with importing an existing gradle project, different Java and Gradle versions, all give the same vague error.

idea.log

Caused by: org.gradle.launcher.daemon.client.DaemonConnectionException: The newly created daemon process has a different context than expected. It won't be possible to reconnect to this daemon. Context mismatch: Java home is different.

I've seen other questions about this but none of those solutions are working for me and I've never had this issue before, 10 years of using IDEA on OSX.

enter image description here

enter image description here

Gregg
  • 34,973
  • 19
  • 109
  • 214
  • Any related errors in [idea.log](https://intellij-support.jetbrains.com/hc/articles/207241085)? Please also share [a screenshot with your Gradle settings](https://i.imgur.com/dgN2UKF.png). – CrazyCoder May 14 '20 at 20:14
  • Updated with the requested info – Gregg May 14 '20 at 20:24
  • How does the JDK configuration look like? Where do you have Java installed? See https://youtrack.jetbrains.com/issue/IDEA-218786 for the related issue. Does it help if you specify Java 11 for Gradle? See also https://youtrack.jetbrains.com/issue/IDEA-239878#focus=streamItem-27-4131212.0-0. – CrazyCoder May 14 '20 at 20:26
  • This indeed was the problem and the solution. Not sure when/how this started happening, but thanks! https://youtrack.jetbrains.com/issue/IDEA-239878#focus=streamItem-27-4131212.0-0 – Gregg May 14 '20 at 20:32

2 Answers2

14

The issue is likely caused by the incorrect Java home path specified for the JDK in IntelliJ IDEA. Make sure it points to the correct location like this:

/Users/rob/.sdkman/candidates/java/14.0.1-zulu/zulu-14.jdk/Contents/Home

On macOS /Contents/Home part of the path is significant.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
1

If some one are using macos with Sdkman use this version: sdk install java 8.0.322-librca for sdk 1.8 or other correlated version from librca, because sdk fom zulu i always had this same problema in intellij idea with java/kotlin and gradlew...

Fernando Nogueira
  • 1,302
  • 1
  • 14
  • 22
  • 1
    This solved my problem (Apple M1 Pro chip, macOS 12.3) - grateful I didn't have to ask a colleague... – jMan Oct 11 '22 at 14:59