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
This commit is contained in:
Jason Tedor 2017-06-22 21:53:16 -04:00
parent d20cd6afcb
commit dc9b67461f
1 changed files with 1 additions and 1 deletions

View File

@ -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