Today's article is going ot focus on how to upgrade from Java 8 to Java 11 on CentOS/RHEL 7 and CentOS/RHEL 8 distributions.
Even though it is still widely supported, Java 8 shouldn't be used anymore. Why? Because support is finally waning. Most application devs have finally moved on to support the newest 'long-term support' (LTS) version of Java, which is Java 11.
The steps below should work for many. I do use OpenJDK, not just the JRE.
Stop all processes that use Java before continuing.
$ sudo yum -y remove java*
$ sudo yum -y install java-11-openjdk-devel
$ sudo alternatives --config java #(select the Java 11 option, usually option '2', then hit enter to save)
$ sudo alternatives --config javac #(select the Java 11 option, usually option '2', then hit enter to save)
And that's it!
Confirm the correct Java version is being used by executing java -version
. It will output "11.0...." or something similar. You will know it is properly installed when you see the 11.
For those that want or need more technical details about installing Java 8 and Java 11 then make sure you read RedHat's excellent blog post about this subject.
-Joey D