I have followed the instructions on numerous pages, such as this, which say to run the following commands:

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

However, when I do this I still get the following error:

me@mycomputer:~$ sudo apt-get install sun-java6-jdk Reading package lists... Done
Building dependency tree Reading state information... Done
Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package sun-java6-jdk has no installation candidate

I realize Java is available from many other sources, but for reasons that I can't get into here I must use this specific version.

What can I do to get this installed?


6 Answers 6


The Sun/Oracle JDK package is no longer available in Ubuntu due to Oracle retiring the 'Operating System Distributor License for Java'. Story here.

Originally Canonical were going to make it so that existing installations of Sun's JRE/JDK would get removed on an apt-get update, but they reversed that decision (however updates/installs will no longer be available).

The recommendation is for users to transition to the OpenJDK 6 package. You can still install the Oracle JDK by downloading from Oracle's website, but it has to be done manually.

  • Does OpenJDK exist for 10.04?
    – dfrankow
    Dec 20, 2012 at 20:47
  • @dfrankow Seems like it according to the package list, though don't know how up-to-date it is.
    – prunge
    Dec 20, 2012 at 21:56
  • Turns out openjdk-6-jdk was available, but did not do what I wanted. It was too early in its dev cycle. I ended up using Sun's jdk from superuser.com/a/439915/56544.
    – dfrankow
    Dec 21, 2012 at 20:52

Also, you might find this blog post helpful. It worked for me and was totally painless (script install vs building your own Java package):

You can find the script and full usage instructions on github.

The quick and dirty guide for using this script is as follows:

cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/master/oab-java.sh -O oab-java6.sh
chmod +x oab-java6.sh
sudo ./oab-java6.sh
sudo apt-get update && sudo apt-get install sun-java6-jdk

The following command should help you get sun jdk6 in ubuntu 10.04

sudo add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
  • 3
    Thank you for the suggestion, but I couldn't get this to work on Ubuntu 12.04 LTS
    – SSH This
    Oct 22, 2012 at 21:52
  • This worked for me on 10.04, which was helpful.
    – dfrankow
    Dec 21, 2012 at 20:55

There are really good instructions for building your own sun-java packages here:


The packages work great for me in Ubuntu Lucid 10.04 x64/i386.


Install OpenJDK instead

sudo apt-get install openjdk-6-jdk


sudo apt-get install openjdk-6-jdk

worked fine for me on ubuntu 10.04



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.