jenv
Manage the $JAVA_HOME environment variable. tldr-pages
On several platforms
Several platforms
Add a Java version to jEnv
jenv add path/to/jdk_homeIdentifyDisplay the current JDK version used
jenv versionIdentifyDisplay all managed JDKs
jenv versionsIdentifySet the global JDK version
jenv global java_versionIdentifySet the JDK version for the current shell session
jenv shell java_versionIdentifyEnable a jEnv plugin
jenv enable-plugin plugin_nameIdentify