虽然有什么open-jdk什么的 但是有时候还是要用oracle的比较正宗
1. add an older repository that has the stuff we need:

1
2
3
4
5
sudo su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update

2.Install:

1
sudo apt-get install oracle-java7-installer

3.make sure java 7 is default.

1
sudo apt-get install oracle-java7-set-default

it’s OK
http://andrewelkins.com/linux/how-to-install-java-7-on-debian-oracle-sucks/
http://blog.retep.org/2013/04/13/installing-java-7-on-debian-squeeze/