diff --git a/tools/install_demo_configuration.bat b/tools/install_demo_configuration.bat index 5bdf96f0f1..5cf4d715fa 100755 --- a/tools/install_demo_configuration.bat +++ b/tools/install_demo_configuration.bat @@ -1,6 +1,14 @@ @echo off set DIR=%~dp0 +set CUR_DIR=%DIR% + +rem set opensearch home for instances when using bundled jdk +if not defined OPENSEARCH_HOME ( + for %%I in ("%DIR%..\..\..") do set "OPENSEARCH_HOME=%%~dpfI" +) +cd %CUR_DIR% + if not "%OPENSEARCH_JAVA_HOME%" == "" ( set "JAVA=%OPENSEARCH_JAVA_HOME%\bin\java.exe" set JAVA_TYPE=OPENSEARCH_JAVA_HOME @@ -13,9 +21,9 @@ if not "%OPENSEARCH_JAVA_HOME%" == "" ( set JAVA_TYPE=bundled jdk ) -if not exist !JAVA! ( - echo "could not find java in !JAVA_TYPE! at !JAVA!" >&2 +if not exist "%JAVA%" ( + echo "could not find java in %JAVA_TYPE% at %JAVA%" >&2 exit /b 1 ) -%JAVA% -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=OFF -cp "%DIR%\..\*;%DIR%\..\..\..\lib\*;%DIR%\..\deps\*" org.opensearch.security.tools.democonfig.Installer %DIR% %* 2> nul \ No newline at end of file +"%JAVA%" -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=OFF -cp "%DIR%\..\*;%DIR%\..\..\..\lib\*;%DIR%\..\deps\*" org.opensearch.security.tools.democonfig.Installer %DIR% %* 2> nul