HHH-8215 - Fix for windows build

This commit is contained in:
Christian Beikov 2013-05-01 21:25:13 +02:00 committed by Steve Ebersole
parent f83a2013b1
commit 1b637030bd
1 changed files with 4 additions and 1 deletions

View File

@ -129,7 +129,10 @@ public class Jdk {
try { try {
final File javaCommand = getJavaExecutable(); 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 { try {
version = extractVersion( new BufferedReader( new InputStreamReader( javaProcess.getErrorStream() ) ) ); version = extractVersion( new BufferedReader( new InputStreamReader( javaProcess.getErrorStream() ) ) );