# config.fish
set -x JAVA_18_HOME (/usr/libexec/java_home -v 18)
set -x JAVA_8_HOME (/usr/libexec/java_home -v 1.8)
# functions/java18.fish
function java18
set -x JAVA_HOME $JAVA_18_HOME
end
# functions/java8.fish
function java8
set -x JAVA_HOME $JAVA_8_HOME
end
Discussion