mac上安装好jdk后,mac就自动帮助配置好了环境变量,但是如果装了1.7又装了1.8的话,就会变成最新的版本1.8。那享用1.7时怎么办?
在home文件夹下的.bash_profile中设置JAVA_HOME
> open .bash_profile
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
> source .bash_profile (for update)
就能把jdk从1.8变成1.7了
http://stackoverflow.com/questions/18144660/what-is-path-of-jdk-on-mac
http://stackoverflow.com/questions/22842743/setting-java-home-environment-variable-on-mac-osx-10-9
http://stackoverflow.com/questions/15826202/where-is-java-installed-on-mac-os-x