Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij idea says Java Home is Different

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=/home/administrator/Downloads/idea-IU-145.1617.8/jre,daemonRegistryDir=/home/administrator/.gradle/daemon,pid=11963,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]

Actual: DefaultDaemonContext[uid=4839fb8c-418b-4666-9a66-40a60133958a,javaHome=/usr/lib/jvm/java-8-openjdk-amd64,daemonRegistryDir=/home/administrator/.gradle/daemon,pid=15202,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]

like image 374
Mohamed Rafiq P Avatar asked Jun 22 '16 07:06

Mohamed Rafiq P


People also ask

How do I change the Java Home Path in IntelliJ?

From the main menu, select File | Project Structure | Platform Settings | SDKs. , select the necessary SDK and specify its home directory in the dialog that opens. Only for JDKs: if you don't have the necessary JDK on your computer, select Download JDK.

How do I check my Java version IntelliJ?

IntelliJ stores the JDK version used by the project within its Project Structure. There are two ways to locate this: Via menu navigation: Navigating to File -> Project Structure.

Does gradle use Java_home?

Gradle uses whichever JDK it finds in your path (to check, use java -version). Alternatively, you can set the JAVA_HOME environment variable to point to the install directory of the desired JDK.

How do I select Project SDK in IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Modules . Select the module for which you want to set an SDK and click Dependencies. If the necessary SDK is already defined in IntelliJ IDEA, select it from the Module SDK list.


1 Answers

Be sure to check and correct JDK version in these 3 places:

  1. Check Preferences -> Build,... -> Build Tools -> Gradle -> Gradle JVM: Gradle Preferences
  2. Check Project Structure -> Project Settings -> Project -> Project SDK:
    Project
  3. Check Project Structure -> Platform Settings -> SDKs: SDKs

Fixing gradle.properties is a dirty workaround. Better fix this at the IDE level.

like image 160
Happy Torturer Avatar answered Sep 23 '22 13:09

Happy Torturer