How to install Sun Java 1.5 on Ubuntu 10.04

I recently had to do some work on Sakai 2.4 but was having trouble building and running it in Java 1.6. This gave me the chance to blow away and re-install an old PC I had lying around, with the latest version of Ubuntu (10.04). However, with the default software source repositories, it only supports Java 1.6 (and prefers OpenJDK too). Here’s how to get Sun Java 1.5 installed on Ubuntu 10.04:

Add the following to /etc/apt/sources.list:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

Update the package list:

sudo apt-get update

Install Sun Java 1.5:

sudo apt-get install sun-java5-jdk

Depending on your setup you might need to set this as the default. Check what version is default:

java -version

And list all Java versions installed:

sudo update-java-alternatives -l

Then if necessary:

sudo update-java-alternatives -s java-1.5.0-sun

If you want to get Sun Java 1.6 installed, instead of OpenJDK, just enable the partner repositories in the Package Manager > Software Sources and it will show up in the list for you to install.

Advertisements

22 thoughts on “How to install Sun Java 1.5 on Ubuntu 10.04

  1. On Ubuntu 10.04

    >> sudo apt-get install sun-java5-jdk

    gives error : Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    Can you suggest what could be going wrong with my setup?

    Thanks
    JP

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s