Install sun-java6-jdk on Ubuntu 10.04 (Lucid)

Sometimes installing Java can be as if someone stabs you hundreds of pencils in the ass. I  had trouble to install the Sun Java6 JDK after updating to Ubuntu 10.04.

The problem was that the system couldn’t find the package sun-java6-sdk and apt-get gave me a bad message:

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

Note on current Debian versions:

SunSDK has been completely removed from the partner archives and the user should move to OpenJDK instead. See also the following links:

You should install OpenJDK instead

sudo apt-get install openjdk-6-jdk

If you still want to run the Sun version:

What I did to solve this problem was to add a new source

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

After that a normal

sudo apt-get update
sudo apt-get install sun-java6-jdk

it worked for me.

What you can also do (i did this on Debian Squeeze):

Adding non-free to the

deb http://ftp.debian.org/debian squeeze main contrib non-free

This worked for me for example in the newest Debian 6 (Squeeze) version.

Update 1:

Thanks for the comment of Mark Zhao. You can also update the /etc/apt/sources.list file and add/uncomment the following lines:

deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner

Update 2:

Thanks to the comment of Reinier, it seems that the Sun Java Packages have been removed from the canonical-archive.

Update 3:

Another tip from a comment by user lipin:

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

 

  • ashok

    PLEASE HELP ME,
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”

    sudo apt-get update

    sudo apt-get install sun-java6-jdk

    even after these steps ,in terminal iam getting—–

    ubuntu@ubuntu-desktop:~$ 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

    PLEASE HELP ME REGARDING THIS ONE

  • Pingback: If I need to install the latest Java SDK, what apt-get should I install?

  • http://none cpuf1xer

    These instructions worked for me a hundred times. They no longer work with Ubuntu 10.04 64 bit. Did something change?

    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

  • Igor Passchier

    The package has been removed completely from the partner archive due to license issue, see https://lists.ubuntu.com/archives/ubuntu-security-announce/2012-January/001554.html

  • http://www.funbuilt.com ken mihara

    I tried what the original author tried, but am still getting the below. Any ideas?

    ubuntu@ip-xx-xx-yy-yy:~$ 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

  • ys

    then how to install sun-java6-jdk on ubuntu 10.04

  • Ram

    how to install that

  • http://www.murraymeehan.com murray meehan

    @Reinier: Agreed. Luckily, installing the sun-java6-jdk from the sun website worked for me, using these instructions: https://help.ubuntu.com/community/Java#Manual_method

  • Noname

    add this to /etc/apt/sources.list : deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse

  • dipin

    To install sun java on ubuntu 10.04 do the following

    sudo add-apt-repository ppa:ferramroberto/java
    sudo apt-get update
    sudo apt-get install sun-java6-jdk

  • IndrekJ

    Works for me:

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk

  • @monkey_punch

    I had to install python properties to execute “add-apt-repository”

    “sudo apt-get install python-software-properties”

  • dmswon

    IndrekJ solution just worked for me. Thanks!

  • jc

    Works for me too:

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk

  • Swami

    Thanks…

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk

    Works for me too..

  • nuis

    thanks so much bro
    it works for me too
    I appreciate U for this post

  • http://panabosale.com Bokz

    Thanks dipin

    this worked for me
    sudo add-apt-repository ppa:ferramroberto/java
    sudo apt-get update
    sudo apt-get install sun-java6-jdk

    my webserver is Ubuntu 10.04

  • http://mikestechspot.blogspot.com Mike

    @dipin thnx

  • jack

    I have run the command “sudo add-apt-repository ppa:ferramroberto/java”,but it returned “add-apt-repository:command not found”

    Mine is ubuntu 9.04

  • Dean

    Hello,
    I followed IndrekJ’s procedure above, and it looked good initially… The install command I entered was:
    $sudo apt-get install sun-java6-jre
    The install seemed to proceed OK, but then what looks like a “license acceptance” screen popped up inside the terminal emulator (GNOME Terminal 2.30.2) and locked up. The label at the top of this screen said ‘Configuring sun-java6-bin’
    However, it is frozen solid. It seems to be looking for an command, but I have no access to it… I can’t highlight and accept it, I can’t enter it from the keyboard… This is absolutely maddening.

    Any suggestions welcome!
    Thanks,
    Dean

  • Dean

    Problem is fixed. In the screen that appeared, using right arrow or left arrow allowed me to highlight the Ok command and enter it, after which installation proceeded OK.
    Thanks!
    Got help from this site:
    http://askubuntu.com/questions/102142/why-fixing-broken-packages-installation-in-ubuntu-11-10-takes-very-long-time-f

  • richi

    nice its working thanks …

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk

  • Uriel

    I had the above problem in Ubunto 10.04 32 bit
    and the solution of @IndrekJ fixed it !

  • http://freedcamp.com angel

    Thank you so much :) Update 3 did it after hours of research.

  • Andrew

    Thanks A million Jc, your information worked for my system perfectly

  • AMMI

    How to install sun-java6.jdk in ubuntu 9.10? Code above not work.

  • Dangi

    Yup, it worked…

    $ sudo add-apt-repository ppa:ferramroberto/java
    $ sudo apt-get update
    $ sudo apt-get install sun-java6-jdk

    thanks a lot :)

  • Pingback: Installing the Old Etherpad | Sowing Stars, Hacking Minds

  • Pingback: Installing Sun Java 6 on Ubuntu 10.04 (Lucid Lynx) | Brian’s Stuff