Make sure to check if you have Java already installed by running:
sudo java -version
On Ubuntu server 10.10 they have moved the program into partner repositories, and disabled it. You need to enable partner repositories in sources.list:
sudo nano /etc/apt/sources.list
remove the comment (the # sign) from the beginning of line on both deb servers, and save the file.
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu maverick partner
update repositories list:
sudo apt-get update
install java:
sudo apt-get install sun-java6-bin
Now check again if everything is ok by running:
sudo java -version
You should get something like:
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)