To install Java in Ubuntu 10.10, follow these steps:

1. Press ALT + F2 and enter this:

gksu /usr/bin/software-properties-gtk


2. Then go to the “Other Software” tab and the first repository on the list should be “ maverick partner” – enable this repository (both lines). Then click “Close” and when prompted, click “Reload”.
3. Then simply search for “sun java” in Ubuntu Software Center and install JRE and the Java plugin, or install it from a terminal using the following command:
sudo apt-get install sun-java6-jre sun-java6-plugin

//The post has been updated with new instructions since Sun Java is now available in Ubuntu 10.10 Maverick Meerkat!