sqlcl 23.2.0
in the ‘sql’ launch script, the function jdk_version has
if [[ -n $(type -p java) ]]
then
java_cmd=java
elif [[ (-n "$JAVA_HOME") && (-x "$JAVA_HOME/bin/java") ]]
then
java_cmd="$JAVA_HOME/bin/java"
fi
which is saying “if I find java in the PATH then I'll use that instead of the one in the JAVA_HOME you asked me to use”
It should be
if [[ (-n "$JAVA_HOME") && (-x "$JAVA_HOME/bin/java") ]]
then
java_cmd="$JAVA_HOME/bin/java"
elif [[ -n $(type -p java) ]]
then
java_cmd=java
fi
Which says “If you gave me a JAVA_HOME, I'll use the java in there, but if not I'll use the java in the PATH”