How to remove Java 10? Or revert to the previous version? The Java updater on my Mac installed an obscure version of Java 10.0.1 which I never heard before. The result is that ALL my java apps are not running anymore, which makes Java pointless.

The official instructions to remove Java are:


sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin


Which is useless because I don't use Java on the browser (who is crazy enough to do it?)


sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane


Which is useless because it just removes the preference pane


sudo rm -fr ~/Library/Application\ Support/Java


Which is useless because this directory is already empty

The official instructions to remove Java on a Mac do absolutely nothing.

If I run my Java apps with java -jar from the terminal they work. From the terminal, I see this:

/usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    1.8.0_131, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
    1.6.0_65-b14-468, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home


So, from the terminal, the Java version is 1.8.0_131, which is my desired version. From the desktop, when I launch apps with JavaAppLauncher, the Java version is 10.0.1.

How can I revert this disaster that Oracle did with their automatic updater?
I believe the problem is navigating to the correct directory... Once you are where you are supposed to be you can run the sudo commands to remove whichever versions of java you want to remove. 

First, run the command in the terminal to determine which version of Java you are running,

java -version


then you can navigate to pesky version of java that you intend to delete by using the following command:

cd /Library/Java/JavaVirtualMachines


then once you see are in the JavaVirtualMachines path, type in ls to see what versions of Java you have installed, 

ls


and finally when you know which version or versions of Java you want to uninstall:

sudo rm -rf jdk-10.0.1.jdk #or whichever version you want to delete