Created
February 12, 2020 09:15
-
-
Save uzzu/c9311e7b450ff539f501ed6af5fa3359 to your computer and use it in GitHub Desktop.
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 javaenv() { | |
local err specified | |
if [[ -z `echo $1` ]]; then | |
echo $JAVA_HOME | |
return | |
fi | |
err=`/usr/libexec/java_home -v $1 2>&1 >/dev/null` | |
if [[ -n $err ]] then | |
echo $err | |
return | |
fi | |
specified=`/usr/libexec/java_home -v $1` | |
echo "export JAVA_HOME=$specified" | |
export JAVA_HOME=$specified | |
export PATH=$JAVA_HOME/bin:$PATH | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment