I installed java 7 on CentOS but it says I have version 1.4.2 installed?

listed in answer

I installed java 7 on CentOS but it says I have version 1.4.2 installed?
0 votes, 0.00 avg. rating (0% score)

ANSWER:

run this command to change the default java:

/usr/sbin/alternatives --config java

add a new one to the list:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_15/bin/java 2

Then run the top thing again to choose the ’2′ as default (or whatever number you put at the end of the install command above).

by Ryan from http://superuser.com/questions/420650