May 312013

Mostly doing this article as a note for the correct way to install java jdk or runtime for kali or debian wheezy.

Download either the jdk or jre tar.gz package from oracle

Install the java-package from debian

apt-get install java-package

Use the make-jpkg command as a normal user to create a debian package from the downloaded archive

fakeroot make-jpkg /path/to/downloaded/jdk-7u21-linux-x64.tar.gz

Once it completes you should see:

The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i oracle-j2sdk1.7_1.7.0+update21_amd64.deb).

Install the package:

sudo dpkg -i oracle-j2sdk1.7_1.7.0+update21_amd64.deb

Locate the file so you can enable support for java in iceweasel:

$ dpkg -L oracle-j2sdk1.7 | grep

Create the symlink to the file:

cd /etc/alternatives
sudo ln -s /usr/lib/jvm/j2sdk1.7-oracle/jre/lib/amd64/
cd /usr/lib/mozilla/plugins
sudo ln -s /etc/alternatives/

Once this is done, close your browser then open it up and visit the java test page (you will need to allow the plugin to run).