pre-requisite:
- enter root shell
- If root account is not enabled, then enable it. Navigate to System > Administration > Users and Groups. And click 'lock icon' and set password for root. Then run "su" to enter root shell.
Use apt-get:
apt-get install sun-java6-jdk sun-java6-jre
when download is complete, you get license popup, select "Ok" and then from next popup select "Yes". Installation will start.
after installation set JAVA_HOME environment variable.
export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.20"