How to install Java 8u121 (JDK/JRE) on CentOS, RHEL

12/02/2020

Java 8u121 recently released, is a programming language and computing platform that is used by lots of applications and websites. It is fast, secure, as well as reliable. Java JDK (Java SE Development Kit) is for developers and it includes a complete JRE plus tools for developing, debugging, as well as monitoring Java applications. Java JRE (Java Runtime Environment) is mostly for end-users, and it contains everything required to run Java applications on your system.

The most recent update Java 8u121 includes important security fixes. See release notes for full details

In this tutorial, we will show you how to install the latest Java 8u121 update on CentOS 7 with a few command lines.

 Java 8u121

How to install Java 8u121 JDK/JRE on CentOS 7

  • Download and extract the latest update package

32bit OS

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz"
tar xzf jdk-8u121-linux-i586.tar.gz

64bit OS

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz"
tar xzf jdk-8u121-linux-x64.tar.gz
  • Change folder ownership
sudo chown -R root: jdk1.8.0_*
  • Now install Java using the ‘alternatives’ command
sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_121/bin/java 1
alternatives --config java
  • Also recommended to setup javac and jar paths
----- For JAR -----
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_121/bin/jar 1
alternatives --set jar /opt/jdk1.8.0_121/bin/jar

----- For JAVAC -----
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_121/bin/javac 2xx
alternatives --set javac /opt/jdk1.8.0_121/bin/javac
  • Remove the downloaded package file
sudo rm /opt/jdk-8u121*.tar.gz
  • Next set the Environment Variables
----- For JAVA_HOME -----
export JAVA_HOME=/opt/jdk1.8.0_121

----- For JRE_HOME -----
export JRE_HOME=/opt/jdk1.8.0_121/jre

----- For PATH -----
export PATH=$PATH:/opt/jdk1.8.0_121/bin:/opt/jdk1.8.0_121/jre/bin
  • Check installed Java version
java -version
ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install and configure Ansible automation on RHEL 8

Ansible is the leading free and opensource configuration management, automation tool. With Ansible, Linux users can control...
13/02/2020

RHEL 7.5 Release Date

Red Hat Enterprise Linux (RHEL) 7.5 Release and Enhancements Even though Red Hat doesn’t disclose future release schedules,...
12/02/2020

Best Alternatives to Red Hat Linux

The recent news of IBM’s purchase of Red Hat sent a ripple through the global open source community, sparking fear that...
12/02/2020
Bài Viết

Bài Viết Mới Cập Nhật

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024

Dịch vụ thuê mua proxy giá rẻ an toàn, tốc độ cao
13/05/2024

Thuê mua proxy V6 uy tín, chất lượng tại đâu?
11/05/2024

Thuê mua proxy Tiktok tăng doanh thu, hiệu quả cao
11/05/2024