Skip to content

Instantly share code, notes, and snippets.

Last active May 10, 2022 13:30
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kenglxn/1843d552dff4d4233271 to your computer and use it in GitHub Desktop.
If you have more javas and you want to switch between the javas, you can select a java from the javas with this...
function jhome
set -x JAVA_HOME (/usr/libexec/java_home $argv)
echo "java -version:"
java -version
Copy link

kenglxn commented Jun 16, 2015

This little ditty uses sets the java_home based on /usr/libexec/java_home to the local shell.


set JAVA_HOME to latest java


set JAVA_HOME to a certain java version

jhome -v 1.7


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment