The Oracle team has discontinued the security updates for Java 8. Also released the latest Java 11 LTS version. Java 11 has been released for general availability with the many featured enhancements. You can read the details here. This article will help you to install Oracle Java 11 on CentOS 7/6, RHEL 7/6 and Fedora 29/28/27/26/25 system.
Step 1 – Download Java 11
Download the latest Java SE Development Kit 11 LTS release from its official download page or use following commands to download from command line.
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/11.0.2+9/f51449fcd52f4d52b93a989c5c56ed3c/jdk-11.0.2_linux-x64_bin.rpm"
Step 2 – Install Java 11
After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package.
yum localinstall jdk-11.0.2_linux-x64_bin.rpm ### CentOS systems dnf localinstall jdk-11.0.2_linux-x64_bin.rpm ### Fedora systems
alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- + 1 /opt/jdk1.8.0_201/bin/java * 2 /usr/java/jdk-11.0.2/bin/java Enter to keep the current selection[+], or type selection number: 2
According to the above screenshot, there are 3 versions installed. Java 11 is listed on number 2, So input numeric 2 and press Enter. Now Java 11 is configured as default Java on my CentOS and Fedora system.
Step 3 – Check Java Version
Check the installed Java version on your system using the following command.
java -version java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
Step 4 – Setup Java Environment Variables
Most of the Java-based applications uses environment variables to work. Set the Java environment variables using following commands
- Setup JAVA_HOME Variable
export JAVA_HOME=/usr/java/jdk-11.0.2
export PATH=$PATH:/usr/java/jdk-11.0.2/bin
Also put all above environment variables in /etc/environment file for auto loading on system boot.
Java is a programming language which is used in lots of places in today’s world from android apps to commercial e-commerce website from financial applications to scientific tools, games, electronic trading devices and other desktop applications similar to IntelliJ, Eclipse, Netbeans from an open source library to J2ME apps.
Thanks for sharing the article.
Thank you!!!
Thank you for useful contents
hi bro it is not working and my system commands not working after installation of java
thanks, but it is not saving in proper way in pdf.
Thank you rahul. It was useful information.