I have been following the Oracle documentation instructions to uninstall Java 1.8 from my Mac as it has compatibility issues with Android Studio and I would like to downgrade to Java SE 1.7.
As per these instructions, Uninstall Oracle Java using the Terminal
Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo. Remove one directory and one file (a symlink), as follows: Click on the Finder icon located in your dock Click on the Utilities folder Double-click on the Terminal icon In the Terminal window Copy and Paste the command below:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
I have followed these instructions and entered those commands. The Java icon disappeared from the system preferences, so I proceeded to install Java 1.7.
After the installation finished a Java icon re-appeared in the system preferences, but when I ran the command
javac -version in terminal it said the version was still 1.8 not 1.7 as I installed.