The very latest version of Sun Oracle JDK can be downloaded from its official website here. The one we need is jdk-7u45-linux-x64.tar.gz. When we got this file, it can be installed with following commands:
mkdir /usr/local/jdk; cd /usr/local/jdk tar zxf ~joseph/jdk-7u45-linux-x64.tar.gz ln -s /usr/local/jdk/jdk1.7.0_45 /usr/local/current-jdk update-alternatives --install /usr/bin/java java /usr/local/current-jdk/bin/java 1 update-alternatives --install /usr/bin/javac javac /usr/local/current-jdk/bin/javac 1 update-alternatives --set java /usr/local/current-jdk/bin/java update-alternatives --set javac /usr/local/current-jdk/bin/javac
Now the installation has finished, the key variable JAVA_HOME for Jdk can be set to /usr/local/current-jdk. These steps should also work for the JDK installation on Debian 6 squeeze.