Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.1.1
-
None
-
None
-
Windows 7 x64
Description
The problem takes place when JAVA_HOME contains "/../". For example:
set THIS_DIR=%~dp0. :: Resolve platform root dir set MB_HOME=%THIS_DIR%\.. :: Resolve java home. set JAVA_HOME=%MB_HOME%\jdk-1.6.0_25-win64 :: Resolve groovy home. set GROOVY_HOME=%MB_HOME%\groovy-2.1.1 call "%GROOVY_HOME%\bin\groovy.bat" "%THIS_DIR%\mb.groovy" %*
In this case we have JAVA_HOME=C:\some\path\scripts\.\..\jdk-1.6.0_25-win64.
In the subsequently called startGroovy.bat the lines:
@rem Validate JAVA_HOME %COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul if not errorlevel 1 goto valid_JAVA_HOME_DIR
give non-zero errorlevel, because the output of DIR command doesn't contain "C:\some\path\scripts\.\..\jdk-1.6.0_25-win64", it actually contains "C:\some\path\jdk-1.6.0_25-win64".
The solution of the problem can be code like:
if exists "%JAVA_HOME%\bin\java.exe" ...