1. Install all the JDK first:
* Mac comes with JDK6, installed in directory:/system/library/java/javavirtualmachines/1.6.0.jdk/.
* Jdk7,jdk8 will need to download and install the corresponding version on the Oracle website. The default path for your own JDK installation is:/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0.JDK
2. Configuration
Create a. Bash_profile configuration file (Skip this step if you already have the file)
#vim编辑. bash_profile file
#如果不习惯vim命令就使用自带的文本编辑器打开
Set JDK version
    |
export   java_6_home=/system/library/java/javavirtualmachines/1.6.0.jdk/contents/home export   java_7_home=/ Library/java/javavirtualmachines/jdk1.7.0.jdk/contents/home Export   java_8_home=/library/java/javavirtualmachines/ Jdk1.8.0.jdk/contents/home   export   java_home= $JAVA _6_home |
Alias command dynamically switches the configuration of Java_home
|
alias jdk8= ' export java_home= $JAVA _8_home ' alias jdk7= ' export java_home= $JAVA _7_home ' alias jdk6= ' export java_home= $JAVA _6_home ' |
#输入完成后保存执行下面命令
#重新执行. bash_profile file
3. Verification:
Use: Jdk6, JDK7, jdk8 to switch JDK versions
1. Install all the JDK first:
* Mac comes with JDK6, installed in directory:/system/library/java/javavirtualmachines/1.6.0.jdk/.
* Jdk7,jdk8 will need to download and install the corresponding version on the Oracle website. The default path for your own JDK installation is:/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0.JDK
2. Configuration
Create a. Bash_profile configuration file (Skip this step if you already have the file)
#vim编辑. bash_profile file
#如果不习惯vim命令就使用自带的文本编辑器打开
Set JDK version
    |
export   java_6_home=/system/library/java/javavirtualmachines/1.6.0.jdk/contents/home export   java_7_home=/ Library/java/javavirtualmachines/jdk1.7.0.jdk/contents/home Export   java_8_home=/library/java/javavirtualmachines/ Jdk1.8.0.jdk/contents/home   export   java_home= $JAVA _6_home |
Alias command dynamically switches the configuration of Java_home
|
alias jdk8= ' export java_home= $JAVA _8_home ' alias jdk7= ' export java_home= $JAVA _7_home ' alias jdk6= ' export java_home= $JAVA _6_home ' |
#输入完成后保存执行下面命令
#重新执行. bash_profile file
3. Verification:
Use: Jdk6, JDK7, jdk8 to switch JDK versions
Multiple JDK configurations in Mac OS (reprint +)