Skip to content

Instantly share code, notes, and snippets.

@danstn
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danstn/78ad5a6321876470f89e to your computer and use it in GitHub Desktop.
Save danstn/78ad5a6321876470f89e to your computer and use it in GitHub Desktop.
chjava bash function
function chjava() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment