bash_profileのJAVA_HOMEを毎回書き換えるのがめんどくさすぎる

JAVA_HOMEを切り替えるときに毎回書き換えをすると面倒なので、あらかじめ全部書いてしまってコメントアウトで切り替えるのが楽です。

$ /usr/libexec/java_home -v "1.6"
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
$ /usr/libexec/java_home -v "1.7"
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
$ /usr/libexec/java_home -v "1.8"
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
sudo vim ~/.bash_profile 
#export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
source ~/.bash_profile