Reputation: 15692
On a desktop with a dual boot I currently have Java JDK 8 in the Linux (Mint) system
chris@M17A ~ $ sudo apt install default-jdk
...
default-jdk is already the newest version (2:1.8-56ubuntu2).
...
chris@M17A ~ $ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
But I'm sure that in fact 1.8.0_171 is not the latest version, even of Java 8! If I want to change to 1.11.xxx, which seems to be the latest LTS release (for Oracle non-OpenJDK at least), what should I do? Do I have to manually download something, or use a PPA? How can I be sure my Linux OS is using the version-11 JRE and the version-11 JDK?
I've also never quite understood either about the versioning of the JRE side of things and how this corresponds to the JDK being used. On my Windows machine (W10) I am using a Java 9 JDK but a Java 8 JRE (I think). Is this a bad thing to do?
This question says there is no such thing in Windows as a Java 11 JRE, although there is a Java 11 JDK. Is that a problem in W10? Would it be a bad idea to use an JDK 11 with a JRE 8?
I also simply don't understand why it is not possible read somewhere about the "latest JRE" or "latest stable JRE". These do not appear to be coupled one-to-one with the latest JDK as far as I can make out but I'm having difficulty obtaining clarity about all this.
I also have some difficulty understanding whether I should opt for OpenJDK or the other JDK (they're both Oracle so I don't know how to refer to the non-OpenJDK one... "commercial JDK"?). But unlike the above difficulties there are lots of explanations out there. I am mainly looking for "latest stable release" hopefully with LTS. Seems like "Commercial JDK" version 11 might be the way to go...
Upvotes: 3
Views: 2490
Reputation: 16475
Java 8 is the default JDK (recommanded) for your System.
According to this, you need to add the repository of openjdk using this command:
sudo add-apt-repository ppa:openjdk-r/ppa
After that you need to update you index using
sudo apt-get update
If you want to install jdk 11 you can do:
sudo apt-get install openjdk-11-jdk
[Hint]
default-jdk
is the default jdk. This means that, if this is up-to-date, you have the recommanded/default version of a jdk.
Also, openjdk seems to be recommanded for linux
Upvotes: 3