Sun Java6 JDK has No Installation Candidate on Ubuntu 10.04

In one of my previous blog posts, I had listed the steps on how to install JDK on Ubuntu. Unfortunately, those steps are not applicable for Ubuntu 10.04 (Lucid).

What happens when trying to install Sun JDK on Ubuntu 10.04?

yee@chimney:~$ 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

Root Cause

On Ubuntu 10.04 LTS, the package sun-java6 is no longer appears in the Multiverse section of the Ubuntu archive. This has been documented in the release note:

https://wiki.ubuntu.com/LucidLynx/ReleaseNotes#Sun Java moved to the Partner repository

How to Fix the Problem?

You can resolve the problem by performing either of the following steps:

  • Install the OpenJDK
    yee@chimney:~$ sudo apt-get install openjdk-6-jdk
  • Install sun-java6 packages from the Canonical Partner Repository
    1. Adding a new source
      sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
    2. Run an update for the new repository
      sudo apt-get update
    3. Now you can install the Sun JDK
      sudo apt-get install sun-java6-jdk

Differences of Java Version Before and After the Package Installation

Before the package installation
yee@chimney:~$ java -version
The program 'java' can be found in the following packages:
* gcj-4.4-jre-headless
* openjdk-6-jre-headless
* cacao
* gij-4.3
* jamvm

After the installation
yee@chimney:~$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

Remaining Steps
  1. Check location of the installed jdk
    yee@chimney:~$ sudo update-java-alternatives -l
    java-6-sun 63 /usr/lib/jvm/java-6-sun
  2. Set JAVA_HOME based on location
    yee@chimney:~$ export JAVA_HOME=/usr/lib/jvm/java-6-sun
  3. Check whether the JAVA_HOME has been set to the correct location
    yee@chimney:~$ echo $JAVA_HOME
  4. Set the JAVA_HOME in /etc/environment
    sudo gedit /etc/environment
    In the /etc/environment, add the following line:
  5. Set in the /etc/bash.bashrc
    export JAVA_HOME
    export PATH
  6. Open another terminal and check the environment path
    yee@chimney:~$ env|grep PATH
facebooktwittergoogle_plusredditpinterestlinkedinmailby feather
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

chin yee


  1. Hi, thx for the tutorial
    can you help me with point 5.
    Where do i set:

    export JAVA_HOME
    export PATH

    here is my /etc/bash.bashrc

    # System-wide .bashrc file for interactive bash(1) shells.

    # To enable the settings / commands in this file for login shells as well,
    # this file has to be sourced in /etc/profile.

    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return

    # check the window size after each command and, if necessary,
    # update the values of LINES and COLUMNS.
    shopt -s checkwinsize

    # set variable identifying the chroot you work in (used in the prompt below)
    if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)

    # set a fancy prompt (non-color, overwrite the one in /etc/profile)
    PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '

    # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
    # If this is an xterm set the title to user@host:dir
    #case "$TERM" in
    # PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'
    # ;;
    # ;;

    # enable bash completion in interactive shells
    #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    # . /etc/bash_completion

    # sudo hint
    if [ ! -e "$HOME/.sudo_as_admin_successful" ]; then
    case " $(groups) " in * admin *)
    if [ -x /usr/bin/sudo ]; then
    cat <<-EOF
    To run a command as administrator (user "root"), use "sudo ".
    See "man sudo_root" for details.


    # if the command-not-found package is installed, use it
    if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found ]; then
    function command_not_found_handle {
    # check because c-n-f could've been removed in the meantime
    if [ -x /usr/lib/command-not-found ]; then
    /usr/bin/python /usr/lib/command-not-found -- $1
    return $?
    elif [ -x /usr/share/command-not-found ]; then
    /usr/bin/python /usr/share/command-not-found -- $1
    return $?
    return 127

  2. In step 4, I wonder if setting


    is a typo? I would expect this:


    Also, when I do an ls of /usr/lib/jvm, I see this:

    java-1.6.0-openjdk java-6-openjdk

    Should I set the java home in the bash.bashrc file to this:

    • In my /etc/environment, I found this:

      But in my bash.bashrc, my setting is following:-

      Probably you should try with the configuration: JAVA_HOME=/usr/lib/jvm/java-6-sun instead as it makes more sense. However, the configuration of /usr/lib/jvm/java works fine for me.

      Le me know how it goes :)

      • As near as I can tell, /etc/environment sets and exports variables on a “global” basis, /etc/bash.bashrc is executed later whenever a shell starts up. So, if you set JAVA_HOME in both spots, the later setting in bashrc overrides the one in /etc/environment.

        Right now I am using
        in both places (because that is where the OpenJDK got installed…)


  3. Thanks so must. i like the way you blog about basic stuff but these are the problems most of us are stuck with. :D

Leave a Reply

Your email address will not be published. Required fields are marked *

Current ye@r *

What is 13 + 12 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)