Nothing fancy , but on macOS
/usr/libexec/java_home
gives you default jdk and
you can export JAVA_HOME by
export JAVA_HOME=$(/usr/libexec/java_home)
https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/
Please follow and like us: