Skip to content

Commit

Permalink
Check that JVM version is 17 (#1589)
Browse files Browse the repository at this point in the history
Aborts startup with a helpful message when the JVM version is not 17.

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored Sep 10, 2023
1 parent 6edbdcb commit 8d3536f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion distributions/openhab/src/main/resources/bin/karaf
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ init() {
# Determine the JVM vendor
detectJVM

# Determine the JVM version >= 1.6
# Determine the JVM version and check that it is version 17
checkJvmVersion
if [ "${VERSION}" -ne "17" ]; then
die "JVM must be version 17. JVM version ${VERSION} is unsupported (JAVA_HOME=$JAVA_HOME)"
fi

# Check if a root instance is already running
checkRootInstance
Expand Down
5 changes: 5 additions & 0 deletions distributions/openhab/src/main/resources/bin/karaf.bat
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ for /f tokens^=2-5^ delims^=.-_+^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do (
if %%j==1 (set JAVA_VERSION=%%k) else (set JAVA_VERSION=%%j)
)

if %JAVA_VERSION% NEQ 17 (
call :warn "JVM must be version 17. JVM version %JAVA_VERSION% is unsupported (JAVA_HOME=%JAVA_HOME%)"
goto END
)

if %JAVA_VERSION% GTR 8 (
pushd "%KARAF_HOME%\lib\jdk9plus"
for %%G in (*.jar) do call:APPEND_TO_JDK9PLUS_CLASSPATH %%G
Expand Down

0 comments on commit 8d3536f

Please sign in to comment.