The Java5 JDK has been packaged as as .deb package ready to install on Ubuntu, without jumping through hoops downloading the RedHat .rpm version and converting to a .deb with the ‘java-package’ utility.
Enable the Multiverse pacakge catalog if you haven’t already done so – in the Software Preferences utility, select ‘Add’ and then select the ‘Multiverse’ option.
You can now install via the Package Manager, or from the command line: sudo apt-get install sun-java5-jdk
Ubuntu comes with the GNU Java compiler which is enabled by default. These instructions walk you through how to select which Java version to run,and how to change between multiple versions, eg gjc to Sun Java5