Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to properly upgrade Java

I have installed and updated to the latest Version of Java.


I am running OS X 10.11.6 (15G31) on iMac.


The Java Control panel shows the correct version and shows the link as:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java


Executing:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

java version "1.8.0_101"


Shows the correct version.

However, executing:

java -version

java version "1.8.0_45"


shows an old version.


Executing:

whereis java

/usr/bin/java


Shows the link as /usr/bin/java


Yet trying to replace the soft link fails:

sudo ln -fs /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java

ln: /usr/bin/java: Operation not permitted


Even when using:

sudo bash (ie as root)


Any ideas?


Thanks

-jim

Posted on Aug 5, 2016 5:16 AM

Reply
26 replies

Aug 5, 2016 6:03 AM in response to -jim

You can have multiple versions of Java installed at the same time.

The java command executes the java pointed to by JAVA_HOME.


When you download Java from Oracle, it only installs the Web Applet Plugin.

If you installed the Java 1.8 JDK previously, then later installed the applet plugin, they could be at two different versions.


/usr/bin/java is a handler for whatever JRE JAVA_HOME points at.

You cannot edit /usr/bin as it is locked down by System Integrity Protection (SIP). It would also be catastrophic.

Aug 5, 2016 7:01 AM in response to -jim

Hello jim,

Java on the Mac is complicated and easily confuses people. You can have as many JVMs as you want, in all kinds of places. Oracle's official Java for the Mac is marketed as a web plug-in. So that JVM is contained entirely in that web plugin directory. But if you set JAVA_HOME properly, you can use it as any other JVM. Now that Apple has washed its hands of Java, there is no place to see all of your JVMs and pick between them. It is all based on your path and environment.


The better question is always, what do you need Java for anyway? With that answer, we can direct you to the best place to find the best Java.

Aug 5, 2016 7:08 AM in response to dialabrain

dialabrain wrote:


I have the last version of Apple's Java and the current Plug-in. I've never installed JDK so I assume that's why I have no /usr/bin/java directory.

/usr/bin/java isn't a directory, it is the Java Application Launcher.

You should have it. It is part of the OS, not specific to any Java version. It is the interface for the OS start running a JVM.

Aug 5, 2016 7:26 AM in response to Barney-15E

Barney-15E wrote:


dialabrain wrote:


I have the last version of Apple's Java and the current Plug-in. I've never installed JDK so I assume that's why I have no /usr/bin/java directory.

/usr/bin/java isn't a directory, it is the Java Application Launcher.

You should have it. It is part of the OS, not specific to any Java version. It is the interface for the OS start running a JVM.

Poor wording on my part. And as it turns out poor vision as well. When I first looked in /usr/bin I didn't see java, so I looked on another Mac and it was there. Then I went back to the first Mac and it was there as well. One of those mornings.

Aug 5, 2016 8:32 AM in response to Barney-15E

Barney-15E wrote:


There are two parts to Java on OS X. There is a web plugin and a JVM. They are entirely separate components.

The direct download at Java.com will only install the web plugin.

The JDK download will install both the JVM and the web plugin.

Well, no. As I mentioned above, Java on OS X is horribly complicated.


The direct download at Java.com will install a web plugin. It also happens to include a fully-functional JVM.

The JDK download will install...the JDK. I don't really know if that includes the web plugin or not. It is the JDK - a tool for building Java programs and applets, not just running them. Did I mention the part about Java being complicated?

Aug 5, 2016 1:06 PM in response to etresoft

Did I mention the part about Java being complicated?

I guess I never found it complicated. You can install multiple versions for whatever needs you have. You point JAVA_HOME to whichever JVM you want as the default, and an app can call java_home to determine what java versions and flavors are available and use the one best suited for the app. I'm not sure why Adobe can't figure it out.


The Web Applet Plugin does not Bogart JAVA_HOME, but does include a JVM to run the applets. You could certainly point your JAVA_HOME there, if desired. Oracle only provides a JVM for running Java programs if you install their JDK.

Aug 5, 2016 7:09 PM in response to Barney-15E

I certainly find it complicated. Then trying to explain the subtleties of the old Java .app wrappers, the web-plugin, JVM, JRE, JDK, environment variables and various command-line hacks posted in 2007 only adds to the confusion. The irony is that Java really isn't any different than any other language with all of this. So why do we always have to deal with the details for Java and only Java?

Aug 6, 2016 8:49 AM in response to -jim

-jim wrote:


But many applications Java might, and on OS-X do, just call java from a shell script or some other means.

JAVA_HOME is not always used.

For instance, on my system, there is no JAVA_HOME set at a command line.

That's the problem that many programs do (OS X doesn't call java, ever). They fail to determine which versions are installed and where they are located and just call /usr/bin/java assuming it points to the correct JVM.

They don't actually have to use JAVA_HOME. All they have to do is use java_home to determine the JVMs that are installed and call the one most appropriate for their use. Neither of which will be available unless a JVM is installed independent of the web applet plugin.


As Apple has dropped all support for Java, the app developers should be bundling a runtime within their apps and not depend on OS X to supply the environment.

How to properly upgrade Java

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.