[
https://issues.apache.org/jira/browse/GROOVY-6023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15935122#comment-15935122
]
David Cole edited comment on GROOVY-6023 at 3/21/17 7:17 PM:
-------------------------------------------------------------
This issue is still unresolved, with the last communication on Jan/2016. The
solution seems simple enough as proposed to add the 'if exists' in the
startGroovy.bat. We once again encountered the issue as of today. Is it
possible for someone to take ownership and make the change to resolve this
issue?
This works for me:
{code}
@rem Validate JAVA_HOME
rem %COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%"
>nul
if exist "%JAVA_HOME%\bin\java.exe" (goto valid_JAVA_HOME_DIR)
rem if not errorlevel 1 goto valid_JAVA_HOME_DIR
rem goto valid_JAVA_HOME_DIR
{code}
was (Author: lewisdavidcole):
This issue is still unresolved, with the last communication on Jan/2016. The
solution seems simple enough as proposed to add the 'if exists' in the
startGroovy.bat. We once again encountered the issue as of today. Is it
possible for someone to take ownership and make the change to resolve this
issue?
> 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)