MacOS – Why does the version of Java verified by Oracle differ from the version shown at the command line

javamacosplugins

Questions

Why do versions differ?

Should we trust Oracle's verification routine?


In some cases, the version verified by Oracle is different from the version shown at the command line.

Example

Screenshot of Safari, the Java console and Terminal

That example, in detail

According to Oracle in the browser:

  • Java 7 Update 9

According to the Java Console:

Java Plug-in 10.9.2.05
Using JRE version 1.7.0_09-b05 Java HotSpot(TM) 64-Bit Server VM

According to the java command:

sh-3.2$ java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b58)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b02, mixed mode)

Best Answer

Problematic uses of terminology

Screenshot of Oracle's 'Verify Java Version' page

Shot of a different Oracle page with the same title

Where Oracle describes first Java for "your operating system" then "for your computer", the download is more accurately only for things that use the Internet plug-in:

  • jre-7u13-macosx-x64.dmg installs what's required for that plug-in, but for things that use Java without the plug-in, this installer from Oracle does nothing.

Hint

On OS X: if you want a Java Runtime Environment (JRE) from Oracle to be like the JRE in the diagram below for both (a) things that use the Internet plug-in and (b) things that use Java without that plug-in:

Additional explanation

Apple's distribution of Java is more than an Internet plug-in.

The Oracle routine pictured above leads to nothing more than a plug-in. Other parts of Apple's distribution are unaffected by Oracle's installer.

Installation of a JDK from Oracle will place a folder at the following path, overriding (not removing) the JDK from Apple:

/Library/Java/JavaVirtualMachines

Within each JDK there is a JRE. Please see the diagram below.

Oracle do actually document this (although it has taken 3 1/2 years to find it) See Oracle's page on OSX command line

The Java Runtime (JRE) that you download from java.com or oracle.com contains a plugin to run Java content from your browser. In order to use the command line tools, you will need to download the Java Development Kit (JDK). The JRE and JDK are separate and can coexist on your system. Only one JRE can be installed on Mac OS X. There can be multiple JDKs installed on a system, as many as you wish.

Thoughts

The huge red button "Download Java Now" is too simplistic. Too many users, including some technical experts, are ultimately puzzled by the end result.

Where a Mac browser is detected by Oracle's server, one of the following phrases might be less misleading:

  • Download Java for your browser
  • Download the Internet-plug-in

Critically

Oracle should offer some explanation in its Mac FAQ (Information and system requirements for installing and using Mac Java 7). The current undated edition of that page lacks an explanation.

Positively

Some users desire or require the JRE of the Internet plug-in to differ from the JRE used elsewhere. For these users, Oracle's effective separation of things may be welcomed.

An example:

  • in Safari and other browsers I use the most recent Java 7 Update 13
  • for Wuala.app and for other things that do not use the Internet plug-in I use early access, developer preview release Java 8 (Java(TM) SE Runtime Environment build 1.8.0-ea-b75).

YMMV.


Reference items

Java Help Center

  • under Terminology, see Versions.

Java Platform Standard Edition 7 Documentation

In the diagram below, from that page, focus on:

  • to the left, the vertical span of the JRE
  • the orange uppermost layer of the JRE – Java Web Start and Apple/Java Plug-in

screenshot of Oracle documentation

Related

How can I switch between the two Java versions in Mountain Lion now that Java Preferences is gone?

Related Question