Okey, this is my second answer to this question, and this is how you install a current JDK on linux! (Its for Debian, but Ubuntu users shouldn't see many differences).
Tools you need:
apt-get install fakeroot zip unzip mkisofs
Now go to java.sun.com and download a current JDK6. It should be names something like jdk-6u20-linux-i586.bin!
We don't want to install it directly to make it behave like a good package. So we use fakeroot to install it as someuser.
mv jdk-6u20-linux-i586.bin ~someuser
su - someuser
fakeroot
chmod a+x jdk-6u20-linux-i586.bin
sh ./jdk-6u20-linux-i586.bin
cd jdk1.6.0_20/man
for i in `find -type f`; do gzip $i; done;
cd ../..
# Tar the results to have them handy for the real installation
tar cfz jdk1.6.0_20.tgz jdk1.6.0_20/
Now we leave fakeroot (Ctrl-D) and the someuser-shell (Ctrl-D again), and install our tar to /usr/local:
cd /usr/local
tar xfvz ~someuser/jdk1.6.0_20.tgz
ln -s /usr/local/jdk1.6.0_20/ /usr/local/jdk
ln -s /usr/local/jdk1.6.0_20/jre/ /usr/local/jre
for program in appletviewer apt extcheck idlj jar jarsigner java javac \
javadoc javah javap javaws jconsole jdb jhat jinfo jmap \
jps jrunscript jsadebugd jstack jstat jstatd jvisualvm \
keytool native2ascii orbd pack200 policytool rmic rmid \
rmiregistry schemagen serialver servertool tnameserv \
unpack200 wsgen wsimport xjc ; do \
update-alternatives --install "/usr/bin/$program" "$program" \
"/usr/local/jdk1.6.0_20/bin/$program" 1130 \
--slave "/usr/share/man/man1/$program.1.gz" "$program.1.gz" \
"/usr/local/jdk1.6.0_20/man/man1/$program.1.gz"; done;
Nun testen ob alles ok ist:
java -version
man java
Done.