Created
March 15, 2012 22:04
-
-
Save lance/2047280 to your computer and use it in GitHub Desktop.
Java version switcher
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
# Props to qmx and abstractj for the inspiration | |
# | |
# Put this file in your home directory and these lines to .profile | |
# if [[ -f "$HOME/.java.env" ]]; then | |
# source "$HOME/.java.env"; | |
# fi | |
VERSION=$1 | |
if [ ! -n "$VERSION" ] | |
then | |
VERSION="1.6" | |
fi | |
echo "Using Java version $VERSION" | |
export JAVA_HOME=$(/usr/libexec/java_home -v $VERSION) | |
alias j7env="source ~/.java.env 1.7" | |
alias j6env="source ~/.java.env 1.6" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment