Fetch error installing Java on Ubuntu 11.04. Solved!

I am running Ubuntu 11.04 and was trying to install the Java OpenJDK 6.0 (and 7.0) on my system but I received the following error:


Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I tried installing several different Java packages but all of them failed with the same error. Finally, I arrived at a working solution by running the following commands:


sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update

Now you can successfully install Java on your system!


sudo apt-get install openjdk-6-jre-headless -y


{ 1 Comments }
  1. amazing! this is the solution i need to solve this error!
    i have ubuntu 11.10 and work perfectly!

Please post your comments/suggestions!