From 1b637030bd53a696cfcadd80d9a7cb3d08d4babb Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 1 May 2013 21:25:13 +0200 Subject: [PATCH] HHH-8215 - Fix for windows build --- .../src/main/groovy/org/hibernate/build/gradle/util/Jdk.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/hibernate/build/gradle/util/Jdk.java b/buildSrc/src/main/groovy/org/hibernate/build/gradle/util/Jdk.java index 4eb21f61b0..4921414f40 100644 --- a/buildSrc/src/main/groovy/org/hibernate/build/gradle/util/Jdk.java +++ b/buildSrc/src/main/groovy/org/hibernate/build/gradle/util/Jdk.java @@ -129,7 +129,10 @@ public class Jdk { try { final File javaCommand = getJavaExecutable(); - Process javaProcess = Runtime.getRuntime().exec( javaCommand.getAbsolutePath() + " -version" ); + + // Fix build for e.g. windows when path to java command contains spaces + // Using the array for Runtime.exec will make sure that arguments with spaces get quoted + Process javaProcess = Runtime.getRuntime().exec( new String[]{javaCommand.getAbsolutePath(), "-version"} ); try { version = extractVersion( new BufferedReader( new InputStreamReader( javaProcess.getErrorStream() ) ) );