Reputation: 21
I installed JDK 1.5 on RedHat 5 and set the paths for JAVA_HOME and PATH in bash_profile. But java -version still shows 1.4
Appreciate if anyone have a solution to fix this issue.
Upvotes: 2
Views: 8679
Reputation: 1
Got this resolved.
which java /usr/bin/java
ls -la /usr/bin/java lrwxrwxrwx 1 root root 22 Jan 6 00:24 /usr/bin/java -> /etc/alternatives/java
ls -la /etc/alternatives/java /etc/alternatives/java -> /appl01/bea/jdk150_22/jre/bin/java
This is was linked to jre 1.4. Modified to point to jre 1.5 and it worked.
Upvotes: 0
Reputation: 718678
After editing .bash_profile
you either need to source it (using the "." builtin) or logout and login again. (Apologies if know this ... )
Upvotes: 1
Reputation: 332491
The JREs can be managed using the /usr/sbin/alternatives function:
alternatives --config java
...will produce a list similar to:
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
Repeat for "javac" if you do Java development.
Upvotes: 6