Java – How to install Sun Java JRE (or JDK) on Ubuntu 10.04

javaubuntu-10.04

I've followed a variety of instructions about modifying my sources.list trying to install Sun's JRE for Java 6 with no luck. The defining error I'm getting appears to be package sun-java6-jdk is virtual.

How do I install sun-java6-jre on Ubuntu 10.04?

Best Answer

The java6 package was moved from the multiverse to the partner repository for Ubuntu 10.04 (and perhaps going forward, for Ubunto 10.10)

Add the repository to your sources.list:

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

Update the source list

sudo apt-get update

And install java

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

The above three steps can also be performed in the gui:

  1. System --> Administration --> Software Sources
  2. Open the Other Software tab
  3. Click + Add...
  4. Enter deb http://archive.canonical.com/ lucid partner
  5. Click +Add Source to accept the new repository
  6. Click Close to update the source list
  7. Open Firefox and open the following URLs:
    • apt:sun-java6-jre
    • apt:sun-java6-plugin
    • apt:sun-java6-fonts

Alternately, if you want to develop in java, you would install the sun-java6-jdk package.

If you have multiple versions of java installed, you may need to change the default version with the sudo update-alternatives --config java command, selecting the one with j2re1.6-sun in it.