i077
i077

Reputation: 11

Java home is different on IDEA Gradle Sync

I'm running IntelliJ IDEA 2016.3 on Windows 10 (x64). I was coming from a fresh install, and installed the JDK and added JAVA_HOME and JDK_HOME variables with the value C:\Program Files\Java\jdk1.8.0_111 to the system environment variables. When opening a project that I had backed up before the reinstall, I get the error:

Gradle sync failed: 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.
            Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\jre,daemonRegistryDir=C:\Users\imran\.gradle\daemon,pid=2016,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
            Actual: DefaultDaemonContext[uid=154af89f-5afd-47f6-83c0-7bbd9bcb05e2,javaHome=C:\Program Files\Java\jdk1.8.0_111,daemonRegistryDir=C:\Users\imran\.gradle\daemon,pid=1264,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
            Consult IDE log for more details (Help | Show Log)

I've tired signing out and restarting to ensure the environment variables are loaded correctly, adjusting the JAVA_HOME to the jre directory in the JDK, changing it to the path the message said it wanted, but nothing so far has worked. I'm not even sure it takes the javaHome variable from the JAVA_HOME environment variable. How do I change it or otherwise get rid of this error? Thanks.

Upvotes: 1

Views: 3583

Answers (2)

Patricio
Patricio

Reputation: 946

Solution given in Importing gradle project in IntelliJ is working for me. Just remember to escape colon and backslashes (and may be other symbols you have):

File: gradle.properties
Line: org.gradle.java.home=C\:\\Program Files\\Java\\jre1.8.0_101

Upvotes: 1

Lagistos
Lagistos

Reputation: 3968

if you install a jdk for win 32 it installs in program files(x86) because this is the folder that contains win 32 programs on win 64 computer.

try to change the value of the JAVA_HOME to the program files (x86) and maybe you installed the jdk for win 32.

Upvotes: 0

Related Questions