Skip to content

Instantly share code, notes, and snippets.

@kenglxn

kenglxn/jhome.fish

Last active Jan 5, 2021
Embed
What would you like to do?
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_HOME:" $JAVA_HOME
echo "java -version:"
java -version
end
@kenglxn

This comment has been minimized.

Copy link
Owner Author

@kenglxn kenglxn commented Jun 16, 2015

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

Usage:

set JAVA_HOME to latest java

jhome 

set JAVA_HOME to a certain java version

jhome -v 1.7

See: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/java_home.1.html

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