Installing Sun Java JDK in CentOS is not as easy as I expected.
Download the Sun Java JDK from the Java SE Downloads page.
Using your root account, or the
sudo command, run the
chmod it if necessary). This will install Java packages.
java -version. In my case, it show
gcj info instead of Sun one.
For selecting the java command, we can use the
alternatives program. Use:
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2
/usr/sbin/alternatives --config java
and select option 2.
java -version now should show Sun JVM info.
Remember that maybe you want to do the same with
javac and other Java commands.
Hope this helps.