From dc9b67461f239b9b77fc6b497488d310f2048ef5 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Thu, 22 Jun 2017 21:53:16 -0400 Subject: [PATCH] Fix use of spaces on Windows if JAVA_HOME not set When JAVA_HOME is not set we try to detect the location of Java. If its location contains a space, due to a lack of quoting we will be unsuccessful in invoking Java. This commit adds the necessary quoting to handle this case. Relates #23822 --- distribution/src/main/resources/bin/elasticsearch.in.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/src/main/resources/bin/elasticsearch.in.bat b/distribution/src/main/resources/bin/elasticsearch.in.bat index a2500833872..d7b985d0824 100644 --- a/distribution/src/main/resources/bin/elasticsearch.in.bat +++ b/distribution/src/main/resources/bin/elasticsearch.in.bat @@ -3,7 +3,7 @@ IF DEFINED JAVA_HOME ( set JAVA="%JAVA_HOME%\bin\java.exe" ) ELSE ( - FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I + FOR %%I IN (java.exe) DO set JAVA="%%~$PATH:I" ) IF NOT EXIST %JAVA% ( ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2