For some reason, you need to use more than one version of jdk on same linux machine. First thing to do is install jdk, you can download from sun. Follow their installation instruction then you should have jdk install in /usr/java/jdk1.6.0_01. but jre still gcj
So use alternatives command to check
add 'sun java' to alternative,config,and check again
Note: For my ubuntu box I get java from backport extra repos by add this two line in /etc/apt/sources.list
then use these command to install and config
[root@mail ~]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.0.2 20051125 (Red Hat 4.0.2-8)
Copyright (C) 2005 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@mail ~]#
So use alternatives command to check
[root@mail ~]# alternatives --display java
java - status is auto.
link currently points to /usr/lib/jvm/jre-1.4.2-gcj/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420
slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj
slave jre: /usr/lib/jvm/jre-1.4.2-gcj
Current `best' version is /usr/lib/jvm/jre-1.4.2-gcj/bin/java.
[root@mail ~]#
add 'sun java' to alternative,config,and check again
[root@mail ~]# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_01/bin/java 2
[root@mail ~]# 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_01/bin/java
Enter to keep the current selection[+], or type selection number: 2
[root@mail ~]# java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
[root@mail ~]#
Note: For my ubuntu box I get java from backport extra repos by add this two line in /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
then use these command to install and config
pnix@pnix-a7:~$sudo apt-get install sun-java6-jdk sun-java6-plugin
pnix@pnix-a7:~$sudo update-alternatives --config java
Comments
Hasan Ali Özaslan
you is my hero