Last active
May 10, 2022 13:30
-
-
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...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jhome | |
set -x JAVA_HOME (/usr/libexec/java_home $argv) | |
echo "JAVA_HOME:" $JAVA_HOME | |
echo "java -version:" | |
java -version | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
set JAVA_HOME to a certain java version
See: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/java_home.1.html