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

 

  • Gangadhar

    Awesome…Thanks a bunch

  • Pingback: Install sun-java6-jdk on Ubuntu 10.04 (Lucid) « Happy Coding » The Blog of Blogs

  • Ali

    Could explain me, How can i first download the package. And then install it off-line?
    So I can install it every time without downloading again.

  • Dan

    Yep, worked. Thanks very much

  • Luke

    Thanks!

  • deepak simaiya

    Thanks a alot ………nw it works…

  • http://www.arktan.com Rahul Aggarwal

    Thank you! This was very useful.

  • Rob

    you rock :)

  • Rinelko

    guys, after install it, i cant sudo apt-get upgrade and update. how?

  • Pingback: Simplest Explanation » Blog Archive » Installing the Sun JDK in Ubuntu Linux

  • kan

    Yes. It works. helpful post. Thanks.

  • ranjith

    i want to install jdk

  • David

    Thanks a lot.
    =============
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    =============

  • Abhijit

    It really helped me a lot … thanks .. u rock

  • meenakshi

    thanks a lot……. thank u sooooooo much !!!!!!!!!! it worked!

  • http://ilab.smu.edu.sg John Goh

    if you can’t find add-apt-repository command, add the repository into /etc/apt/sources.list manually

  • http://www.google.com Otavio

    Thank you a lot
    Worked just fine !!!!

  • Pingback: Motor GeoEstadístico (Postgresql – Postgis – Geoserver – Openlayers – R – Grails) « abxda

  • Mark Zhao

    The normal way is to edit /etc/apt/sources.list to uncomment out these two lines:
    deb http://archive.canonical.com/ubuntu lucid partner
    deb-src http://archive.canonical.com/ubuntu lucid partner

    Then do
    apt-get update

    This will fix it forever!

  • aladdin

    thanks you saved me

  • Laszlo

    To: Mark Zaho

    Thanks so much! Your solution worked like a charm!

    I just installed the latest version of Ubuntu server and just doing the ‘apt-get update’ didn’t do the trick, but after I uncommented those two lines it’s working!

    Your solution should be incorporated into the main article so one does not need to pore through all the comments to find the solution ;-)

  • Ashwin

    Solution works fine, thanks a lot

  • Ramin Rezazadeh

    Thanks!

  • Nitesh

    Works for me too.

  • http://www.happy-coding.com/ Daniel

    @Laszlo: Thanks. Added the tip to the main article.

  • Stone

    Wow…you save my life!! Rock man!!

  • Ping

    Awesome, worked perfectly on Ubuntu 11.04, thanks.

  • Ping

    After using your fix I was able to implement the fix on website ” http://www.imlucas.com/post/263896412/ubuntu-fix-for-unable-to-locate-tools-jar-expected-to ” to solve my problem. Thanks again.

  • @megatron

    Thanks Much. You rock.

  • kiran

    how to execute nesc coding in ubuntu 10.04?plz explain the procedure?

  • Victor

    Thanks!

  • http://www.52smap.com xiangzhuyuan

    thanks! well done!

  • Rajesh

    Thanks a lot.. useful post…

  • pvspain

    Problem with this recipe under oneiric (Ubuntu 11.10)

    Edited /etc/apt/sources.list to uncomment out these two lines:
    deb http://archive.canonical.com/ubuntu oneiric partner
    deb-src http://archive.canonical.com/ubuntu oneiric partner

    Then did..
    sudo apt-get update (worked ok)
    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

    Is sun-java6-sdk no longer available beyond lucid?

  • mickey

    Thank you. Very useful post. Chears from Bosnia :)

  • manish

    Thank you so much..

  • newbie

    awsome! Thanks for help

  • http://www.dcaclab.com hopewise

    thank you very much! it worked for me too :-)

  • http://devblog.x-sphere.com Matt Brotherson

    Cheers mate!

  • Haleel

    Thanks man…

    Awesome……………..

  • paci

    @pvspain:

    Substitute the lines
    deb http://archive.canonical.com/ubuntu oneiric partner
    deb-src http://archive.canonical.com/ubuntu oneiric partner

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

    redo apt-get update and install

    After installation, for a clear configuration, you can re-insert “oneiric” word instead of “lucid” and re-comment those lines.

  • Thanks

    Thanks

  • honey

    this was very helpful. thank you very much. :)

  • Stelios P.

    it WORKED!

  • http://android-apps-heaven.blogspot.com/?v=0 android versions

    I just like the valuable information you provide in your articles. I’ll bookmark your blog and check once more right here frequently. I’m somewhat sure I’ll learn a lot of new stuff right here! Good luck for the next!

  • thangnbq

    Thanks so much ! Success

  • sheetal

    I substituted lucid with ‘oneiric’, but still i get the same error

    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

  • http://www.linux.or.ug Reinier

    This fix doesnt work anymore. Canonical removed all sun java packages from the repository.

    this might help http://blog.flexion.org/2012/01/16/install-sun-java-6-jre-jdk-from-deb-packages/

  • Rob Starling

    Ugh… it appears to have disappeared from the archive.canonical.com repo. Is it working for anyone?

    Thanks!
    –Rob*

  • Jaime

    Not here and I spend a good couple of days trying to find it. You can get a manual install file from oracle website (.bin file for Linux, i think there were some redhat packadges there too) for just about any update version (java 6 latest is version 31).