Installing Java Sun JDK 1.5 or 1.6 on Ubuntu 10.10 or 11.04 (updated: 01 Jun 2011)

Posted: August 10, 2011 in Android, Java, Linux
 
As we know, Java 1.5 has not been maintained anymore and Java 6, has been hanging around for a while and Java 7 is coming soon. But it doesn’t mean everybody has to move on to Java 1.6. The problem in Ubuntu is they force you to use OpenJDK. Worse yet, they don’t let you downgrade to 1.5.There are lots of legacy systems running on Java 5 and we can’t forget that. It is also about freedom of choice. If you want to install Sun JDK 5 or 6 Ubuntu should not make your life difficult.

Ubuntu 10 and 11 don’t allow us to natively (or easily) install Sun JDK’s via apt-get.

It is so frustrate when we try to install it on Ubuntu 10.10 and have no luck:

sudo apt-get install sun-java5-jdk (or sudo apt-get install sun-java6-jdk)

After installed, the JDK will go to this directory: /usr/lib/jvm/java-6-sun

You can see all JDK’s installed running the following command:

sudo update-java-alternatives -l

After a while, finally got the solution for this:

sudo add-apt-repository “deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse”

sudo add-apt-repository “deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse”

sudo apt-get update

sudo apt-get install sun-java5-jdk

Check it out just to confirm:

sudo update-java-alternatives -l

The commands above worked for me in Ubuntu 10 and 11, installing Sun JDK 1.5 and 1.6.
If it doesn’t work, try to add the following repositories and repeat the process: (anonymous suggestion – thanks a lot):

sudo add-apt-repository “deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse”
sudo add-apt-repository “deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse”

Cheers
http://leonardo-pinho.blogspot.com/2010/11/java-15-no-ubuntu-1010.html

Advertisements
Comments
  1. fypandroid says:

    The last thing worked for me on Ubuntu 10.04….

    NOTE:When it starts downloading jdk, then a ‘license window’ appear which can only be executed by pressing a TAB key then press ENTER (mouse or any other key will not work here).

  2. Siwei Shen says:

    thank you very much … I found this solution after trying a whole day… thank you thank you thank you … the source you gave is correct, other sources are all dead (all of them don’t contain JDK5 package)

    again ,you saved my life, thank you !!!!

  3. fypandroid says:

    Thank you for your comment. Glad we could help 🙂

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