Gradle JAVA_HOME path in eclipse

10,288

Solution 1

In Preference of Eclipse (main menu: Window -> Preferences), select

Gradle -> Arguments -> Java Home, select "Workspace JRE".

Then select one of your jdk in your workspace.

Solution 2

Create/update gradle.properties in GRADLE_USER_HOME ( C:\users\<user>/.gradle or linux ~/.gradle) with 

org.gradle.java.home=<path to jdk>
Share:
10,288
InvictaAnima
Author by

InvictaAnima

Updated on June 30, 2022

Comments

  • InvictaAnima
    InvictaAnima almost 2 years

    I have a problem running Gradle project in eclipse Neon.2. I find out that there is a problem with JDK path. Somehow my gradle in elipse always use some strange JRE as a Java Home, when it should use a path to a JDK. I double checked my settings in eclipse and system variables, but still i cant find the solution.

    I searched for answers and find out that people suggested changing Gradle settings in elipse. I did all the settings but it still doesnt work.

    All the settings

    Btw, if I manualy set the Java Home while creating Gradle project it all works fine. But it has to work on other computers so I cant really use that solution.

    That works fine

  • zhuhang.jasper
    zhuhang.jasper about 6 years
    There's no "Argument" section under Gradle for me
  • Delli Kilari
    Delli Kilari about 6 years
    It should be, Can you post some screen shot here with version your using and so.
  • zhuhang.jasper
    zhuhang.jasper almost 6 years
    Eclipse Oxygen 3a. Screenshot of Eclipse: imgur.com/cRfF2D0 Any way, I fixed it by specifying the java path in C:\Users\YourUserName\.gradle\gradle.properties file
  • rinilnath
    rinilnath over 2 years
    There is no such argument in 4.7.2 oxygen version of eclispe. @zhuhang.jasper. How did you set the value in gradle.properties?
  • zhuhang.jasper
    zhuhang.jasper over 2 years
    @rinilnath have you tried the above answer by mujibur-rahman ?
  • rinilnath
    rinilnath over 2 years
    @zhuhang.jasper, Yes, i edited gradle.properties in my local project folder to hold the value of JDK home from my system. org.gradle.java.home=C:/Program Files/Java/JDK1.8.0.45