What can be easier? I ran into a problem when I have to have Java 1.8 by default and other JDKs for testing. I had JDK12.
Of course, we can use recommendations from the official oracle web site. It was these instructions:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
But I still had JDK12 by default. In path ‘/Library/Java/JavaVirtualMachines’ I had 3 different JDK. I’ve found some instruction and it just works for me.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
And if we want to remove plugins:
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist
I hope it was helpful to you.