NOTE THAT YOU HAVE TO TYPE YOUR VERSION OF JAVA WHERE IT SAYS jdk-9.jdk
Type in
java - version
you will get a result that says something like:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
copy whatever is where [VERSION] is in this line
java version "[VERSION]"
then paste it into where it says [version] here
sudo rm -fr /Library/Java/JavaVirtualMachines/[VERSION].jdk/
now type in
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
then
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
now retype
java -version
it should say you have no java. if not go back to the beginning replacing [VERSION] with your new result
install version 8 and restart