JDK Website: http://www.oracle.com/technetwork/java/javase/downloads/index.html
1. 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.7.0_71.JDK
2. Configuring the Java_home Path
Input in Terminal: Vim ~/.BASHRC
Enter edit mode: I
Configuring the JDK Path: Export java_home=/library/java/javavirtualmachines/jdk1.7.0_71.jdk/contents/home
3. Detect if configuration is successful
Java-version
The following information is displayed:
Java Version "1.7.0_71"
Java (TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot (TM) 64-bit Server VM (build 24.71-b01, Mixed mode)
PS: Jenv can also be used to install the JDK, specific reference Jenv.io
Install configuration JDK under Mac