Installing Java 7 (Oracle) in Debian via apt-get


If you want install Java on your Debian server, you can use this guide:
Download Java 7 (Oracle) from Java Downloads for Linux. Download *.tar.gz files.

$ ls -la j*.tar.gz
-rw-r--r-- 1 data data 138199690 Mar  7 00:58 jdk-7u51-linux-x64.tar.gz
-rw-r--r-- 1 data data  46904005 Mar 19 00:08 jre-7u51-linux-x64.tar.gz

Then install Debian package java-package, which provides the capability to build a Debian package from a Java binary distribution by running make-jpkg jre-7u51-linux-x64.tar.gz

$ sudo apt-get install java-package

Now you can create Debian package from Java binary distribution:

$ for i in j*.tar.gz; do make-jpkg $i; done
$ ls -la *.deb
-rw------- 1 data data 113159102 Mar 19 00:18 oracle-java7-jdk_7u51_amd64.deb
-rw------- 1 data data  31789926 Mar 19 00:15 oracle-java7-jre_7u51_amd64.deb

And then install packages with standard dpkg command:

$ sudo dpkg -i oracle-java7-*.deb