Skip to content

Instantly share code, notes, and snippets.

Last active January 9, 2018 22:07
What would you like to do?
JDK switching
#list available jdks
alias jdks="/usr/libexec/java_home -V"
# jdk version switching - e.g. `jdk 6` will switch to version 1.6
function jdk() {
echo "Switching java version";
export JAVA_HOME=`/usr/libexec/java_home -v 1.$1`;
java -version;
export PATH=\$JAVA_HOME/jre/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment