kcadm.bat, kcreg.bat do not respect environment variables JAVA, JAVA_… (#23630)

* kcadm.bat, kcreg.bat do not respect environment variables JAVA, JAVA_HOME to select JVM

* edited kcadm.bat and kcreg.bat scripts

Closes #23214

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* kcadm.bat, kcreg.bat do not respect environment variables JAVA, JAVA_HOME to select JVM

* incorporated suggestions

Closes #23214

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* kcadm.bat, kcreg.bat do not respect environment variables JAVA, JAVA_HOME to select JVM

* incorporated suggestions

Closes #23214

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

---------

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral 2023-10-20 15:51:54 +02:00 committed by GitHub
parent c18e8ff535
commit f2dc57bfe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 16 deletions

View file

@ -5,4 +5,26 @@ if "%OS%" == "Windows_NT" (
) else (
set DIRNAME=.\
)
java %KC_OPTS% -cp "%DIRNAME%\client\keycloak-admin-cli-${project.version}.jar" --add-opens=java.base/java.security=ALL-UNNAMED -Dkc.lib.dir="%DIRNAME%\client\lib" org.keycloak.client.admin.cli.KcAdmMain %*
if "x%JAVA%" == "x" (
if "x%JAVA_HOME%" == "x" (
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur. 1>&2
echo Set JAVA_HOME to the directory of your local JDK to avoid this message. 1>&2
) else (
if not exist "%JAVA_HOME%" (
echo JAVA_HOME "%JAVA_HOME%" path doesn't exist 1>&2
goto END
) else (
if not exist "%JAVA_HOME%\bin\java.exe" (
echo "%JAVA_HOME%\bin\java.exe" does not exist 1>&2
goto END
)
set "JAVA=%JAVA_HOME%\bin\java"
)
)
)
"%JAVA%" %KC_OPTS% -cp "%DIRNAME%\client\keycloak-admin-cli-${project.version}.jar" --add-opens=java.base/java.security=ALL-UNNAMED -Dkc.lib.dir="%DIRNAME%\client\lib" org.keycloak.client.admin.cli.KcAdmMain %*
:END

View file

@ -5,4 +5,26 @@ if "%OS%" == "Windows_NT" (
) else (
set DIRNAME=.\
)
java %KC_OPTS% -cp "%DIRNAME%\client\keycloak-client-registration-cli-${project.version}.jar" --add-opens=java.base/java.security=ALL-UNNAMED -Dkc.lib.dir="%DIRNAME%\client\lib" org.keycloak.client.registration.cli.KcRegMain %*
if "x%JAVA%" == "x" (
if "x%JAVA_HOME%" == "x" (
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur. 1>&2
echo Set JAVA_HOME to the directory of your local JDK to avoid this message. 1>&2
) else (
if not exist "%JAVA_HOME%" (
echo JAVA_HOME "%JAVA_HOME%" path doesn't exist 1>&2
goto END
) else (
if not exist "%JAVA_HOME%\bin\java.exe" (
echo "%JAVA_HOME%\bin\java.exe" does not exist 1>&2
goto END
)
set "JAVA=%JAVA_HOME%\bin\java"
)
)
)
"%JAVA%" %KC_OPTS% -cp "%DIRNAME%\client\keycloak-client-registration-cli-${project.version}.jar" --add-opens=java.base/java.security=ALL-UNNAMED -Dkc.lib.dir="%DIRNAME%\client\lib" org.keycloak.client.registration.cli.KcRegMain %*
:END

View file

@ -119,22 +119,24 @@ if "%DEBUG_MODE%" == "true" (
rem Setup Keycloak specific properties
set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%
if "x%JAVA%" == "x" (
if "x%JAVA_HOME%" == "x" (
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
echo JAVA_HOME is not set. Unexpected results may occur. 1>&2
echo Set JAVA_HOME to the directory of your local JDK to avoid this message. 1>&2
) else (
if not exist "%JAVA_HOME%" (
echo JAVA_HOME "%JAVA_HOME%" path doesn't exist
echo JAVA_HOME "%JAVA_HOME%" path doesn't exist 1>&2
goto END
) else (
if not exist "%JAVA_HOME%\bin\java.exe" (
echo "%JAVA_HOME%\bin\java.exe" does not exist
echo "%JAVA_HOME%\bin\java.exe" does not exist 1>&2
goto END
)
set "JAVA=%JAVA_HOME%\bin\java"
)
)
)
set "CLASSPATH_OPTS=%DIRNAME%..\lib\quarkus-run.jar"