Apple - How to remove Java 10? Or revert to the previous version?

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

If you have more than one version of jdk:

$ ls -l /Library/Java/JavaVirtualMachines
drwxr-xr-x  3 root  wheel  96 30 avr 15:15 jdk-10.0.1.jdk
drwxr-xr-x  3 root  wheel  96 30 avr 15:24 jdk1.8.0_172.jdk
drwxr-xr-x  3 root  wheel  96 17 oct 10:59 jdk1.8.0_191.jdk

change your JAVA_HOME

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

I had this same problem: I had Java 8 installed, but later installed 10. Then, I removed 10, and when I launched a jar from the terminal it would run in version 8, and when I checked the version with java -version in the terminal I would get back java version "1.8.0_181. However when I ran a .jar from the Finder, it would run in v.10, and also if I went to the Java preference pane the version was listed as version 10. This was undesirable: I was trying to remove v10 completely.

Then, I deleted JavaAppletPlugin with rm /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin and reinstalled Java SE JDK 8 from online, and lo! it works now. When I run .jar, they run in Java 8.

I realize you mentioned this in your first step, but I infer that you didn't do this step? If I'm wrong about that then you've got a different problem. But this solved mine.

Tags:

Java