How to Install Java 7 on Ubuntu

I just went through the fairly painful process of installing Java 7 on Ubuntu. I say “painful” because there’s no dpkg yet available that I could find and most of the tutorials I found only update the java(1) binary and not all of the executables for the JDK. So, I’m going to post proper instructions on how to do this for the children (they are the future, after all).

First, download the .bin installer file from here. Then unpack it via:

sh jdk-7-ea-bin-b98-linux-x64-17_jun_2010.bin

It will ask you to accept the license by typing yes at the end. Do this. It will then produce a directory called jdk1.7.0. Now you’ll want to put that directory in its proper location in /usr/lib/jvm: