Skip to content

Instantly share code, notes, and snippets.

@Noyabronok
Last active January 9, 2018 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Noyabronok/0a90e1f3c52d1aaa941013d3caa8d0e4 to your computer and use it in GitHub Desktop.
Save Noyabronok/0a90e1f3c52d1aaa941013d3caa8d0e4 to your computer and use it in GitHub Desktop.
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