switch between java versions

November 25, 2016

Suppose with Redhat you have 2 java versions installed:

# rpm -qa | grep java
> java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
> java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
> java_cup-0.10k-5.el6.x86_64
> tzdata-java-2016c-1.el6.noarch
>

Which java version is doing it for you ? You can check like this:

[root@svbtest ~]# rpm -qa | grep java
java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
java_cup-0.10k-5.el6.x86_64
tzdata-java-2016c-1.el6.noarch

Now if you want to have the 1.5 version active, you can switch like this:

# sudo update-alternatives –config java
There are 2 programs which provide ‘java’.
Selection Command

Comments are closed.

Next Post
»