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

Amazon Linux vs RHEL

Amazon has taken the top spot as a cloud services platform.  The Amazon EC2 (Elastic Compute Cloud) service allows you to...
12/02/2020

How to Become Red Hat Certified and Is It Worth It for Your Career?

Red Hat’s contribution to the open source community is immeasurable. The American multinational software company is probably...
12/02/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
Bài Viết

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

Reliable IPv4 and IPv6 Subnet Rental Services: The Perfect Solution for Global Businesses
23/12/2024

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024