Create a script called java.sh and put the code below. Place the script in /etc/profile.d
Make sure you edit the paths so that they match your own version of java and make it executable. After that, logout and back in again or do "source /etc/profile" and the sun java version should be detected before GCJ. If you have OpenOffice installed, then Redhat and derivatives insist on installing GCJ.