Thursday, May 30, 2013

How to update JDK on Oracle Enterprise Linux from version 1.6 to 1.7

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:

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

Step 2: The current JDK version is:

[root@test 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
[root@test 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:

[root@test 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/ :

[root@test bin]# pwd
/usr/java/jdk1.7.0_21/bin
[root@test 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:

[root@test 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 !!!

4 comments:

for IT the said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

for IT the said...

Java Training Institutes Java Training Institutes Java EE Training in Chennai Java EE Training in Chennai Java Spring Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai Core Java Training Institutes in Chennai Core Java Training Institutes in Chennai

Gopi Perumal said...

Cool post.. Loved it..
SAP Training in Chennai | SAP Training Institutes in Chennai | Best SAP Training in Chennai

Gopi Perumal said...

Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
Regards,

Oracle Training in Chennai | Oracle DBA Training in Chennai