Skip to content

Commit dc9b674

Browse files
committed
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
1 parent d20cd6a commit dc9b674

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

distribution/src/main/resources/bin/elasticsearch.in.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
IF DEFINED JAVA_HOME (
44
set JAVA="%JAVA_HOME%\bin\java.exe"
55
) ELSE (
6-
FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
6+
FOR %%I IN (java.exe) DO set JAVA="%%~$PATH:I"
77
)
88
IF NOT EXIST %JAVA% (
99
ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2

0 commit comments

Comments
 (0)