$ sudo apt-get install openjdk-6-jdk
After installation, you can try to get version information like below
$ java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1) OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)