Install Java on Ubuntu/Linux

I am a windows user, and wonder how do I go about installing java on Ubuntu (VirtualBox)

I have tried

sudo apt-get install sun-java6-bin

got

couldnt find package

sudo apt-get install sun-java6-jre

got

sun-java6-jre has no installation candidate

I also tried the .bin file:

sudo chmod 755 <filename>.bin
./<filename>.bin

Seems like it has done its things without errors, but

java -version

gives

the program 'java' can be found in the following package ...


Sun Java has been moved to the Partner repository in Ubuntu 10.04 (Lucid Lynx).

Add the repository by doing this:

add-apt-repository "deb http://archive.canonical.com/ lucid partner"

Then you can do:

sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts