Proposed fix: buildscript java version detection fails on Linux/Ubuntu on Picked up JAVA_TOOL_OPTIONS

info at info at
Wed Aug 26 17:08:43 UTC 2015

The gradle build tries to find the version of the used Java JDK by 
running 'java -version', skipping the first line and expects to find the 
version in the second line.

However, on Linux (Ubuntu) the first line of *any* Java invocation is 
-javaagent:/usr/share/java/jayatanaag.jar"[1], thus failing at detection 
of the version, aborting the build.

The 'Pickup up...' line is a standard feature of the JDK and a legacy 
that doesn't seem to be removed soon[2].

I guess the build script needs to accommodate for this.

Proposed fix:

// Determine the verion of Java in JDK_HOME. It looks like this:
// $ java -version
// Picked up JAVA_TOOL_OPTIONS: 
// java version "1.7.0_45"
// Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
// Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
// The first line is optional, we need to parse the third line
def inStream = new java.lang.ProcessBuilder(JAVA, 
try {
     String v = inStream.readLine();

     if (v != null) {
	if (v.startsWith("Picked up")) {

         v = inStream.readLine();


More information about the openjfx-dev mailing list