[ 
https://issues.apache.org/jira/browse/GROOVY-6023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15936271#comment-15936271
 ] 

Paul King commented on GROOVY-6023:
-----------------------------------

We basically don't have any test coverage for startGroovy.bat so we need to 
find some extra time to do some more manual testing when making changes to it. 
Our experiences are that windows bat files are in general quite brittle. I 
suspect in this case it is just a matter of going through that file and 
checking for the other special cases that are handled and whether they need the 
same treatment.

> ERROR: JAVA_HOME is set to an invalid directory
> -----------------------------------------------
>
>                 Key: GROOVY-6023
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6023
>             Project: Groovy
>          Issue Type: Bug
>          Components: command line processing
>    Affects Versions: 2.1.1
>         Environment: Windows 7 x64
>            Reporter: Maxim Butov
>
> The problem takes place when JAVA_HOME contains "/../". For example:
> {code}
> 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" %*
> {code}
> 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:
> {code}
> @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
> {code}
> 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:
> {code}
> if exists "%JAVA_HOME%\bin\java.exe" ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to