Gradle build progress

Richard Bair richard.bair at
Sat Mar 23 22:52:42 PDT 2013

> I can confirm I have the same problem that Peter has (btw, I tried with Gradle 1.3 and seem to work to the same extent that 1.4 does). I guess the real solution is to open another couple of bits of code ;)

I may have found the root cause here (or at least, a root cause). The basic problem is that on Windows the JRE is installed twice -- once in jre8 and once in jdk1.8.0/jre. Which one the developer might have on their path is anyone's guess (but if their system is like mine, it will be jre8). The other platforms don't do this -- at least, definitely not on Mac and I have yet to see this on Linux. The result is that the logic that tried to guess the JDK directory location didn't work on windows. I'm not sure this new logic is really going to work either in the long term, but it works for today. If there is a more bulletproof solution that doesn't require every developer to manually specify JDK_HOME or JAVA_HOME, then I'd like to know it!

Here it is, in all its grizzly glory:

// Get the JDK_HOME automatically based on the version of Java used to execute gradle. Or, if specified,
// use a user supplied JDK_HOME, BINARY_STUB, JAVAC, and/or JAVAH, all of which may be specified
// independently (or we'll try to get the right one based on other supplied info). There is a really
// odd situation on windows where you can have two JRE's on the same system(!!!):
//    c:\Program Files (x86)\Java\jdk1.8.0\jre
//    c:\Program Files (x86)\Java\jre8\
// Because of this, you may sometimes get the jdk's JRE (in which case the logic we used to have here
// was correct and consistent with all other platforms), or it might be the standalone JRE (for the love!).
// So what we have to do is add some special windows-only logic here to figure out the JDK based on the
// wrong JRE, if we happen to have gotten the wrong JRE.
ext.JAVA_HOME = System.getProperty("java.home");
def javaHomeFile = file(JAVA_HOME);
defineProperty("JDK_HOME", == "jre" ?
        javaHomeFile.getParent().toString() :"jre") ?
        new File(javaHomeFile.getParent(), "jdk1.${}.0").toString() :
        JAVA_HOME); // we have to bail and set it to something and this is as good as any!

In order to debug your system, run something simple like:

gradle projects --info

See what is reported for the JAVA_HOME and JDK_HOME and BINARY_STUB. If JDK_HOME isn't pointing to the actual JDK directory (and you haven't manually specified the BINARY_STUB) you will have problems. If the BINARY_STUB isn't pointing to the jfxrt.jar of the latest JDK directory, then you'll have problems (unless you copied that file somewhere else and are pointing at it instead).


More information about the openjfx-dev mailing list