Error message "JVM version 11 is unsupported" persists

If you ask me, I really don’t know but I have performed an upgrade to 4.1.

How to find out what openhab version is additionally installed ?

I don’t have experience with package management on MacOS.
How did you install Java 17 ?
Does this Installing & switching between multiple JDK on macOS | by Manvendra P Singh | Medium help ?

Installation is performed by double click at the *.dmg file, the installer.
Everything else is performed automatically.

No I tried installation, reinstallation …
openhab is always looking for a jdk11 version

Do you have more than one Java version installed ?
If this is the case is it possble to remove JDK11 ?
If not can you try to force using 17 by setting environment variables like JAVA_HOME that points to version 17 ?

I tried
setjdk 17
but nothing changed

The enviroment variables $xxxx are not in use at macos.

Did you check /etc/profile for version specific configurations? If I search for your error message it seems to be one of the places which may need to be updated.

at mac

System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval /usr/libexec/path_helper -s
fi

if [ “${BASH-no}” != “no” ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

usr/libexec/java_home -V
Matching Java Virtual Machines (1):
17.0.8.1, x86_64: “Zulu 17.44.53” /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

Yes, but at macs the file only a general script.

Instead of

can you try to run

sh -x start.sh

and see if that gives some more information about what is set.

sh -x start.sh

  • echo Launching the openHAB runtime…
    Launching the openHAB runtime…
  • ‘[’ ‘!’ -z ‘]’
    ++ dirname start.sh
  • RUNTIME=./runtime
  • exec ./runtime/bin/karaf
    Unable to find any JVMs matching version “11”.

Thank you for that trial. I did expect it to show more.
So we need to check something else. What is shown by executing:

/usr/libexec/java_home -V

Could you further check the following. In directory … you should find a file setenv.
In the download from openhab.org I see this code

locateJava() {
    # Setup the Java Virtual Machine
    if ${cygwin} ; then
        [ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}")
        [ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --unix "${JAVA_HOME}")
    fi

    if [ "x${JAVA_HOME}" = "x" ] && [ "${darwin}" = "true" ]; then
        JAVA_HOME="$(/usr/libexec/java_home -v 11)"
    fi
    if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
        JAVA_HOME=$(java-config --jre-home)
    fi
    if [ "x${JAVA}" = "x" ]; then
        if [ "x${JAVA_HOME}" != "x" ]; then
            if [ ! -d "${JAVA_HOME}" ]; then
                die "JAVA_HOME is not valid: ${JAVA_HOME}"
            fi
            JAVA="${JAVA_HOME}/bin/java"
        else
            JAVA=$(command -v java)
            if [ "x${JAVA}" = "x" ]; then
                die "java command not found"
            fi
        fi
    fi
    if [ "x${JAVA_HOME}" = "x" ]; then
        JAVA_HOME="$(dirname "$(dirname "$(pathCanonical "${JAVA}")")")"
    fi
}

Pay attention to the row that contains

 JAVA_HOME="$(/usr/libexec/java_home -v 11)"

That row is only executed if JAVA_HOME is not set and it then will set JAVA_HOME to use version 11.
Could you try to set JAVA_HOME to the correct directory to prevent this row from being executed.

/usr/libexec/java_home -V
/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    17.0.8.1, x86_64:	"Zulu 17.44.53"	/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

I have now removed the jdk17 double installation:

/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
17.0.8.1, x86_64: “Zulu 17.44.53” /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

It looks much better but does’t solve the problem

Try on command line

export JAVA_HOME=$(/usr/libexec/java_home -v 17)

then check if JAVA_HOME is set in the current shell:

echo $JAVA_HOME

Does the startup now work ? If it does you need to make sure that the JAVA_HOME variable is set before running start.sh

I have tried to solve the problem this way:

generate in home directory
.zshrc

export JAVA_HOME=(/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home)

but no effect:

zsh
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
root@lbpm ~ # /Users/openhab/openhab/./start.sh
Launching the openHAB runtime…
Unable to find any JVMs matching version “11”.

my .zshrc has now additionally the folllowing line

export JAVA_HOME=$(/usr/libexec/java_home -v 17)

./start.sh
Launching the openHAB runtime…

Thank You very much. The error message vanished

which results in

1 Like