How to Update JDK on Oracle Enterprise Linux from Version 1.6 to 1.7

Posted in: Technical Track

JDK is the environment to develop Java programs, and updating Java on Linux boxes is a requirement which often comes up. The following lists the steps required to update the JDK from version 1.6.0_22 to 1.7.0_21.

Step 1: Download the JDK rpm from the following link:

https://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Step 2: The current JDK version is:

[[email protected] software]# java -version
java version “1.6.0_22”
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.41.1.10.4.el6-i386)
OpenJDK Client VM (build 20.0-b11, mixed mode)

Step 3: Run the following command to update the JDK:

rpm -Uvh jdk-7u21-linux-i586.rpm

[[email protected] software]# rpm -Uvh jdk-7u21-linux-i586.rpm
Preparing…                ########################################### [100%] 1:jdk                    ########################################### [100%] Unpacking JAR files…
rt.jar…
jsse.jar…
charsets.jar…
tools.jar…
localedata.jar…
plugin.jar…
javaws.jar…
deploy.jar…

Step 4: Check the version:

[[email protected] software]# java -version
java version “1.6.0_22”
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.41.1.10.4.el6-i386)
OpenJDK Client VM (build 20.0-b11, mixed mode)

Step 5: So the version is still pointing to the old one. We have to use the alternatives here to update the version. The newly installed Java is at this location /usr/java/jdk1.7.0_21/ :

[[email protected] bin]# pwd
/usr/java/jdk1.7.0_21/bin

[[email protected] bin]# /usr/sbin/alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_21/bin/java 17021

Step 5: Now it should point to the latest version:

[[email protected] bin]# java -version
java version “1.7.0_21”
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)

That’s it !!!

email
Want to talk with an expert? Schedule a call with our team to get the conversation started.

About the Author

I have been in love with Oracle blogging since 2007. This blogging, coupled with extensive participation in Oracle forums, plus Oracle related speaking engagements, various Oracle certifications, teaching, and working in the trenches with Oracle technologies has enabled me to receive the Oracle ACE award. I was the first ever Pakistani to get that award. From Oracle Open World SF to Foresight 20:20 Perth. I have been expressing my love for Exadata. For the last few years, I am loving the data at Pythian, and proudly writing their log buffer carnivals.

9 Comments. Leave new

Good post! Is the JDK not available in the yum repository?

Reply

Hi Jimmy, thanks for the comments. I tried downloading it first from yum repository of OEL, but it wasn’t there.

Reply

Good post – exactly what I was looking for.
Request, an update;
yum nor rpm works on my linux box, as the RHEL is not registered.
So the only alternatives I have is using a tar.gz ball.
So please can you update your article (to include upgrading jdk using a .tar.gz ball)

thank you.

Reply

/usr/sbin/alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_21/bin/java 17021

I could not understand why we are passing 17021?

Reply

Really Good Post !! It helps me

Reply

hi am using Linux 4 Update 8
and i have installed jdk 1.7 on my previous version 1.4 but when i type
#java -version
showing
[[email protected] java]# java -version
Error: dl failure on line 863
Error: failed /usr/java/jdk1.7.0_51/jre/lib/i386/server/libjvm.so, because /lib/tls/libc.so.6: version `GLIBC_2.4? not found (required by /usr/java/jdk1.7.0_51/jre/lib/i386/server/libjvm.so)
so i want to uninstall 1.7 and go for 1.6. how to uninstall 1.7 please guide me
Thanks

Reply

Hi Rathna,
Thanks for your comment. You can uninstall Java by following doc:

https://www.java.com/en/download/help/linux_uninstall.xml

HTH,

Fahd

Reply
Taslim Tamboli
June 3, 2021 5:45 am

HI,

i am using Red Hat Enterprise Linux Server release 6.10 and jdk version java version “1.8.0_144”
Need to update jdk to jdk1.8.0_291. i have installed rpm also but it is showing old version. Am getting below error-
[[email protected] java]$ /usr/sbin/alternatives –install /usr/java/jdk1.8.0_291-amd64/bin/java 180291
alternatives version 1.3.49.5 – Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.
Please assist.

Regards
Taslim

Reply

This does nothing in my case, no errors or not updated version

/usr/sbin/alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_21/bin/java 17021

Reply

Leave a Reply

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