java versions and how to not get confused with them

0

I am aware that there is the JRE and the JVM. I have also programmed in Java, so not a total beginner. However lately I am getting very confused and would appreciate a current response to my question.

Which version of JRE and JVM do I have and which is the latest one?

Now before feeling like telling me "google it", I have already googled it. Therefore my confusion.

In the java homepage it says:

Under the General tab in the Java Control Panel, the version is available through the About section. A dialog appears (after clicking About) showing the Java version.

Well, I did that and I have Version 8 Update71.

in that homepage it also says:

The JRE and JDK are separate and can coexist on your system. Only one JRE can be installed on Mac. There can be multiple JDKs installed on a system, as many as you wish.

Alright, I know that already. So I do what they say to get the version from the terminal and I get

java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)

Alright, it seems the same. So now comes the question:

Which version do I have? I mean the Version 8 is the JRE version? or is it the JVM version? In the homepage although they distinguish them (as the quote), the instruction to get the version is the same!

To even complicate matters, I go to wikipedia and there it says that the current supported versions are Java 8 and Java 11. Why two? and what happened to 9 and 10? And again, are these JRE or JVM?

Can someone explain this to me?

KansaiRobot

Posted 2018-12-01T08:33:21.970

Reputation: 199

Answers

1

It seems to me that your questions are answered in the same Wikipedia article:

Java 8 and Java 11 are the currently supported long-term support (LTS) version and Java 10 is the previous supported rapid release version. Java 10 support ended on the same date that support for Java 11 began, in September 2018. Java 7 is no longer publicly supported, Java 9 has stopped receiving updates. since Java 9 was a short-term rapid release version that has been superseded by Java 10, and "end of public updates" for Java 8 is scheduled for January 2019 for commercial use, and not earlier than December 2020 for non-commercial use. For Java 11, long-term support will not be provided by Oracle; instead, the broader OpenJDK community, as AdoptOpenJDK, is expected to perform the work.

So versions 9 and 10 were short-lived. I guess that they were stop-gap measures that were rushed out in response to serious security bugs.

Version 8 is the last version still supported by Oracle and divided into JDK and JRE. Version 11 seems to have dropped this division and to have only a unified JDK version based on OpenJDK, so it might not have the performance enhancements found in the paid version of Oracle's Java.

For finding what versions you have on Linux, I suppose that you can query the installed packages.

On Windows, you may find that information in the registry for 32-bit and 64-bit at:

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft
  • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft

You may also find that information in Control Panel > Java (32-bit) or Control Panel > Java (64-bit):

enter image description here

harrymc

Posted 2018-12-01T08:33:21.970

Reputation: 306 093

Thanks. I am using a mac. I wonder how to find the JDK and JRE there – KansaiRobot – 2018-12-01T11:48:32.983

Thanks! (btw, I never downvote any answer, it is not in my character :) – KansaiRobot – 2018-12-01T12:31:23.837

Thank you. The first part of my answer is still useful, and I'll keep the second part for Windows users. – harrymc – 2018-12-01T12:32:33.897

@kansai I do hope if someone posts an incorrect answer you'll help the rest of us know that by down voting it. Voting, both up and down, is an important part of how we help each other identify useful answers. Thanks for contributing. – I say Reinstate Monica – 2018-12-01T13:09:31.737

@TwistyImpersonator: An incorrect answer for one poster may be the correct one for another. I don't hold with downvoting answers. If someone went to the effort of thinking of an answer and posting it, he shouldn't be penalized for his effort, but rather encouraged to continue. – harrymc – 2018-12-01T18:06:31.583

I'm not suggesting one down votes answers they don't like. I mean down vote answers that are wrong. We owe this feedback to users who are less able to discern correct from incorrect answers on their own. – I say Reinstate Monica – 2018-12-01T19:15:21.807

0

You are confusing some of the terms and you are on a Mac where Oracle has confused some of them as well.

There are I think 4 different things.

  1. JVM(Java Virtual Machine) this is in all releases of Java and is the executable that runs the Java compiled class files. It is not directly downloadable but is part of the other 3 items. java -version shows the version of this you are using.

  2. JDK(Java development kit) This is the installation that you need if you are writing programs. It includes the compiler and other tools. For macOS with Oracle releases this is the only download that supplies an environment startable by /usr/bin/java

  3. JRE(Java Runtime Environment). In Windows, Linux and Apple releases of Java this supplies the minimum selection of files needed to jun a Java program from the command line. It does not seem to exist as part of an Oracle macOs release, However this is the Java(TM) SE Runtime Environment shown by Java version.

  4. JRE(Java Runtime Environment) on macOS. From Oracle this is the environment that runs Java applets in your browser. This is the JRE that you can only have one of on your mac. This is also the one that is seen and updated by the Java control panel in System Preferences.

So on macOS from the command line you install the JDK which includes a JRE and that includes a JVM and you can have many versions of these. There is also a separate JRE(not the same as the command line) that runs applets in your browser and is in the Java control panel and you can have only one of these.

As for version numbers etc As far as I understand after version 8 they have changes the version numbering. Wikipedia says

In September 2017, Mark Reinhold, chief Architect of the Java Platform, proposed to change the release train to "one feature release every six months" rather than the current two-year schedule,[1][2] and later the proposal took effect.

Thus 9,10 have been replaced by 11 and 12 is due in March 2019 - see https://en.wikipedia.org/wiki/Java_version_history for as to timings and en of support.

To find the JVMs that you can use from the command line run /usr/libexec/java_home -V

I get

/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
Matching Java Virtual Machines (6):
11.0.1, x86_64: "OpenJDK 11.0.1"    /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
10.0.1, x86_64: "Java SE 10.0.1"    /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
9.0.1, x86_64:  "Java SE 9.0.1" /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
1.8.0_171, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
1.8.0_92, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
1.8.0_77, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home

To install and choose which JDK see https://stackoverflow.com/questions/52524112/how-do-i-install-java-11-on-mac-osx-allowing-version-switching

user151019

Posted 2018-12-01T08:33:21.970

Reputation: 5 312