HowTo Update Java Version Linux Step by Step Guide

Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to data centers, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!. In this article we are going to see HowTo Update Java Version Linux Step by Step Guide.

Update Java Version Linux Procedure

# java -version
java version "1.7.0_141"
OpenJDK Runtime Environment (rhel-2.6.10.1.el7_3-x86_64 u141-b02)
OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)

Existing Java Version is 1.7.0_141 and we are going to update to 1.8.0_144, Is that simple

Download extra package file from Java site using wget command, below package is 64 bit 

# 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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"

Java Download Link

32 bit Java Download method is below

# 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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-i586.tar.gz"

To Download Java directly from command line use below method visit java download link provided above, right click on required package click on Copy Link Address

Java Download Trick command line

Java Download Trick

Login to Terminal and add below strings before download link (Update Java Version Linux)

# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "PASTE URL"

Extract Java Downloaded Package for Update Java Version. Use tar command 

# cd /opt/java
# tar -xvf jdk-8u144-linux-x64.tar.gz

Update Java Version

run Update Java Version command to Update existing Java Package version

]# update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_144/bin/java
]# update-alternatives --config java

There are 3 programs which provide 'java'.

Selection Command
-----------------------------------------------
*+ 1 java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jre/bin/java)
 2 /usr/java/jdk1.8.0_144/jre/bin/java
 3 /opt/java/jdk1.8.0_144/bin/java

Enter to keep the current selection[+], or type selection number: 3

Let’s add variable path to Java

# export JAVA_HOME=/opt/java/jdk1.8.0_144/
# export JRE_HOME=/opt/java/jdk1.8.0_144/jre
# export PATH=$PATH:/opt/java/jdk1.8.0_144/bin:/opt/java/jdk1.8.0_144/jre/bin

Now Verify Java Version

# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Update Java Version Linux is completed successfully. Java Version is now 1.8

Related Articles

Disable IPv6 on Centos 7

rht-vmctl command

Better RHCSA Or RHCE

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

1 Response

  1. sayanora says:

    Thanks. Can you please let me know the steps to upgrade the current JDK (open JDK) version from:

    [root@APP ~]# rpm -qa | grep -i jdk
    jdk1.8.0_144-1.8.0_144-fcs.x86_64

    to the version “JDK 1.8.0_261” ? I do not want to break the current integration.

    Thanks a lot in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *