MacOS – Can’t update Java due to apparently newer version already installed

javamacos

I'm trying to update Java on my MacBook (OS X 10.9.5). When I download the most resent version (v8 update 40) from java.com and try to install it, it pops up an error box saying

You are trying to install 1.8.40.27, however 14.9.0 is already installed

and that's it. In a terminal I get

java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

But Firefox → Tools → Add-ons shows Java 14.9.0 (and says it's outdated), though there is no option to de-install it.

So, how can I install the most recent Java 8.40? How can I uninstall this mysterious Java 14.9.0?

Best Answer

According to apple.discussions.com the install of Java8 should work after removing an older Java plugin with the following command:

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