Skip to content

Instantly share code, notes, and snippets.

@xemoe
Last active August 29, 2015 13:57
Show Gist options
  • Save xemoe/9848169 to your computer and use it in GitHub Desktop.
Save xemoe/9848169 to your computer and use it in GitHub Desktop.
Java use multi version
alias java_ls='/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home'
function java_use() {
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
export PATH=$JAVA_HOME/bin:$PATH
java -version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment