There are several things going wrong and I don’t know how to resolve it.
I have two JDKs one is in C:\Program Files\java\jdk1.8, and another one is in C:\IBM\WAS80\java and I have defined a JAVA_HOME to point to C:\IBM\WAS80\java.
when I import the java gradle project to eclipse ( I installed the buildship 2.0 to the Eclipse), I was given a screen asking for Gradle folder, and I have typed in the location of Gradle 2.14.1. On the same screen I was supposed to see an advanced options which ask me to type in the JDK location, but I don’t see anywhere to ask for this. This is the first question: why I am not shown a text box for me to type in the JDK location?
then in my “Gradle Tasks” view I clicked on “war” under build, the build was successful and when I see the log in the console, the JDK location is always “C:\Program Files\java\jdk1.8”, which I should make the gradle build pointing to C:\IBM\WAS80\java?
The option to specify a JDK location in the advanced options was only available in Buildship 1.x. It was removed in Buildship 2.x with the expectation that you will use the standard org.gradle.java.home property to set your JDK/JRE as that will cause both command line and Buildship to function the same. Details of this property are in the User Guide in the Build Environment section.
Thanks James. I am constructing a gradle.properties file and the content is simply:
org.gradle.java.home=C:\IBM\WAS80\java
But I get an error when importing the project.
Caused by: org.gradle.api.GradleException: Java home supplied via ‘org.gradle.java.home’ is invalid. Invalid directory: C:IBMWAS80java
yes I did escape them but simply it didn’t work. Can you simply give one example? I also found all the gradle doc just tell you how to do, never give an example, but I think the exampe is the most easy way to let people learn its syntax.
the last confusion, in this discussion though, is, why the gradle import and gradle build in the eclipse gui doesn’t take my environment variable definition of JAVA_HOME in the windows system setting? However if I run “gradlew clean build” in the CLI, gradew does pull the value from JAVA_HOME in the windows system setting?
That’s because Eclipse doesn’t use JAVA_HOME, but instead uses the path specified in eclipse.ini. There is a longstanding feature request to improve that.