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

Understanding Red Hat Linux Price and Pricing

Despite being around for two decades and being one of the most popular Linux server distributions, the pricing of Red Hat...
29/12/2020

Install Google Chrome on RHEL8

This tutorial explains how to install Google Chrome with 2 commands only (wget and yum install) as an introduction to packages...
13/02/2020

How to Upgrade from RHEL 7 to RHEL 8

Long waited Red Hat Enterprise Linux 8 (RHEL 8) was released recently. One of the ways of getting RHEL 8 is to download...
13/02/2020
Bài Viết

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

Dịch Vụ Xây Dựng Hệ Thống Peering Với Internet Exchange (IXP)
04/04/2025

Dịch Vụ Triển Khai VPN Site-to-Site & Remote Access
04/04/2025

Dịch Vụ Thiết Lập Hệ Thống Tường Lửa (Firewall)
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ảo Hóa & Cloud
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ceph
04/04/2025