Problem changing Java version using alternatives
- by Brian Lewis
I'm not quite sure how I got into this mess, but for some reason I'm not able to change the current version of Java using alternatives. I can run alternatives --config java and type my selection but when I echo the version number for either java or javac, it spits back out 1.5 every time (despite alternatives showing the current version is 1.6). The server I'm working with is running RHEL5, by the way.
I have verified that the paths used in alternatives are pointing to the correct directories. Here's some output from my session:
[brilewis@myserver]$ sudo
/usr/sbin/update-alternatives --config
java
There are 3 programs which provide
'java'.
Selection Command
** 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
+ 2 /usr/java/jdk1.5.0_10/bin/java
3 /usr/java/jdk1.6.0_16/bin/java
Enter to keep the current
selection[+], or type selection number: 3
[brilewis@myserver]$ java -version
java version "1.5.0_10" Java(TM) 2 Runtime
Environment, Standard Edition (build
1.5.0_10-b03) Java HotSpot(TM) Server VM (build 1.5.0_10-b03, mixed mode)
[brilewis@myserver]$ sudo /usr/sbin/update-alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
** 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /usr/java/jdk1.5.0_10/bin/java
+ 3 /usr/java/jdk1.6.0_16/bin/java
Enter to keep the current selection[+], or type selection number: