The new version of java you installed probably isn't in your path, or it is in your path but it comes after the older version of your java.
Just for kicks, try typing javac -version.
If it's 1.6 or whatever your target version is, then your java is installed, but it doesn't have priority in your path, so it's a matter of
finding where your updated java program is and then adding it to the front of your path. For me, it's in /usr/lib/jvm. Maybe that's the Sun default or something, so try it out. But you'll likely have to look for it.
Once you find it, you can add your updated java to your path in a couple ways... one is the local solution, which is to modify .bash_profile or .profile in your home directory. The other is to modify /etc/profile which is the global solution. In my ~/.profile file I have at the end:
if [ -d /usr/lib/jvm/java-6-sun ] ; then
PATH=/usr/lib/jvm/java-6-sun/bin:"${PATH}"
fi