How do I install the JDK on MacOS X?
To Oracle's website, download the JDK file (which should be a DMG file) used by the MacOS operating system. After the download is complete, go to the local, locate the DMG file that you just downloaded, double-click it and follow the prompts to install it step-by-step.
After the installation is complete, open terminal, enter the command: Java-version and then enter, you can see Java version information similar to the following.
Java version "1.8.0_111" Java (tm) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot (tm) 64-bit Server VM (Build 25.1 11-B14, Mixed mode)
If a similar message appears, this version of jdk1.8.0_111 is currently installed on your computer.
How do I uninstall the JDK installed on MacOS X?
This is very easy. For example, I want to uninstall jdk1.8.0_73.
Open Terminal
Enter the following command to enter the directory where the JDK1.8.0_73.JDK is stored
Cd/library/java/javavirtualmachines
Then enter the following command
sudo rm-rf jdk1.8.0_73.jdk
You will be prompted for an administrator password, and the system will automatically remove the jdk1.8.0_73 after you enter the password.
This article is from the "Bitterjava" blog, make sure to keep this source http://rickqin.blog.51cto.com/1096449/1890254
"Organize" JDK & Macos X