Monday, May 30, 2011

Upgrading JDK to latest version

Below given is a self-explanatory example for upgrading JDK from version 1.4.2 to 1.6.0_25.


[root@host01-d1 ~/]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@host01-d1 ~]# alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java

Enter to keep the current selection[+], or type selection number:
[root@host01-d1 ~]# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_25/bin/java 2
[root@host01-d1 ~]#
[root@host01-d1 ~]# alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_25/bin/javac 2
[root@host01-d1 ~]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
   2           /usr/java/jdk1.6.0_25/bin/java

Enter to keep the current selection[+], or type selection number: 2
[root@host01-d1 ~]# alternatives --config javac

There are 2 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.4.2-gcj/bin/javac
   2           /usr/java/jdk1.6.0_25/bin/javac

Enter to keep the current selection[+], or type selection number: 2
[root@host01-d1 ~]# java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)


[root@host01-d1 ~]# which javac
/usr/bin/javac
[root@host01-d1 ~]# which java
/usr/bin/java
[root@host01-d1 ~]# /usr/bin/java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@host01-d1 ~]# which javac
/usr/bin/javac
[root@host01-d1 ~]# ls -l /usr/bin/javac
lrwxrwxrwx 1 root root 23 May 25 00:24 /usr/bin/javac -> /etc/alternatives/javac
[root@host01-d1 ~]# ls -l /etc/alternatives/javac
lrwxrwxrwx 1 root root 31 May 25 15:26 /etc/alternatives/javac -> /usr/java/jdk1.6.0_25/bin/javac
[root@host01-d1 ~]#

No comments:

Post a Comment