How to install OpenJDK 6 on Ubuntu 10.04 (Lucid Lynx)

September 08, 2012

I have been playing with Vagrant (opens in a new tab) and Puppet (opens in a new tab) a lot recently and I had some trouble getting OpenJDK 6 (opens in a new tab) to install on Ubuntu 10.04 (Lucid Lynx) (opens in a new tab).  Since I had so much trouble finding the consolidated answer, I've decided to post my solution here.

The problem stems from the fact I want to install OpenJDK via a Debian package (opens in a new tab).  Lucid Lynx's default apt (opens in a new tab) setup doesn't include the correct repositories needed to install OpenJDK.  To get this to work, you need to add the correct repository to apt.  I accomplished this by using the 'add-apt-repository' python library, like so:

$> sudo apt-get install python-software-properties
$> sudo add-apt-repository "deb http://archives.canonical.com/ lucid partner"

Once this is done, you need to update the the apt-get cache.  You can do this with the following command:

$> sudo apt-get update

Now that apt-get is all up to date, you can finally install OpenJDK 6 JRE with the following command:

$> sudo apt-get install openjdk-6-jdk

I hope this helps!