22

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?

2

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.

  • yes i did not try to delete the applet plugin because anyway i disabled it in the browser – Magnetic_dud Sep 4 '18 at 21:56
  • Makes total sense. But, based on my experience, it seems that the presence of JavaAppletPlugin is affecting what version of Java is used to run .jar apps from the Finder. For me, I deleted the JVM v10, but only when I deleted JavaAppletPlugin did the finder stop using v10 for running .jar apps. – postylem Sep 6 '18 at 15:39
39

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
  • The problem is that the version that the control panel shows does not match the java version in the terminal. If I want to remove java 8.171 looks like there is no way also: imgur.com/a/iIK67bD – Magnetic_dud May 21 '18 at 7:03
  • And the jdk 10.0.1 was not present in that folder – Magnetic_dud May 21 '18 at 14:06
7

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
-1

I downloaded the old (working) version from java.com

In fact, Java 8.171 is the download that's shown by default. I dunno why it got automatically updated to 10.0.1 when it's beta quality.

Now, it won't install it, it says "Sorry, you have the newer and better 10.0.1 Java"

For installing, run the apparently useless commands mentioned in the question. Java will still work in the terminal, but then the installer will allow you to install the right version, 1.8_171

Now, disable the updates, if you don't want to break your apps again. Java is a security threat, it should be updated monthly, so make sure that it is disabled in your browser.

For some reason, if you run java -version you still get:

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

Which is another wrong version. Anyway, the important is that now your Java apps are working, make sure the browser plugin is disabled for your security.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .