Howto: Install Sun Java on Ubuntu 10.04 Lucid Lynx

Sun Java and the Sun Java browser are not installed by default on Ubuntu 10.04 lucid lynx.  Instead, Ubuntu uses the OpenJDK and the Icedtea web browser plugin.  Typical users may never notice a difference as OpenJDK works well in most cases.

However, you may find that you need the real Sun Java instead of the open substitutes.  I will show how to completely remove the OpenJDK packages and how to install the real Sun Java packages.

To completely remove the OpenJDK and Icedtea packages

I removed OpenJDK and IcedTea6 packages with the following command.  On my server, this removed a total of 8 packages.   Before answering “Y” to the following command, look at the full list of packages that it will be removing .   It will attempt to remove other packages which have a dependence on Java.  If you are uncomfortable with some of them, then you should  skip the removal step and move on to the next step and install SUN Java alongside OpenJDK.  The final step will allow you to select Sun Java as the default.

$ sudo apt-get purge openjdk-6-jre openjdk-6-jre-headless
Reading package lists... Done

The following packages will be REMOVED:
ca-certificates-java* icedtea-6-jre-cacao* icedtest6-plugin*
libaccess-bridge-java* libaccess-bridge-java-jni* openjdk-6-jre*
openjdk-6-jre-headless* openjdk-6-jre-lib*

0 upgraded, 0 newly installed, 8 to remove and 48 not upgraded.
After this operation, 87.5MB disk space will be freed.
Do you want to continue [Y/n]? Y

Enable the Canonical partner repository

The Sun Java packages are found in the Canonical partner repository.  Add the partner repository to your repository sources.


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

Install the Sun Java packages

Now install the Sun Java packages.  Most people will need only the following packages:

  • sun-java6-jre
  • sun-java6-plugin
  • sun-java6-fonts

$ sudo apt-get install sun-java6-jre sun-java6-plugin
$ sudo apt-get install sun-java6-fonts

If you think that you will need the Java development kit, then add sun-java6-jdk to the list.

  • sun-java6-jre
  • sun-java6-plugin
  • sun-java6-fonts
  • sun-java6-jdk

$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-jdk
$ sudo apt-get install sun-java6-fonts

Now set your system to use the Sun Java JRE and Dev packages as the default


$ sudo update-java-alternatives --set java-6-sun

Be sure to restart your web browser so that it will be able to use the sun-java6-plugin.  If you want to verify your version of java then you can do:

$ java -version

If you would like to verify that your web browser java plugin is working, then open your web browser  here

Click on the “Verify Java version” button.

Verifying that the java browser plugin is working

That is all.

About these ads

7 thoughts on “Howto: Install Sun Java on Ubuntu 10.04 Lucid Lynx

  1. Thank you Very Much :)
    I Actually installed Sun-Java alongside Open-Jdk and thought that it would automatically be the default but upon close inspection of firefox “about:plugins” i realized Open-Jdk was actually the default all along.
    I have since run “$ sudo update-java-alternatives –set java-6-sun” and finally i have Sun-Java showing up in firefox “about:config” an then finally the java site verified that i had the latest version.
    I have both Open-Jdk & Sun-Java installed on my Pc , can having them both installed lead to any confilicts ?..

    Thanks again

  2. Pingback: ubuntu install « askRaj's Blog

  3. Pingback: How to remove openjdk in ubuntu and install sun java « Everything about nothing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s