Java is one of those programs (plugins) a system cannot live without. Everyone visits sites daily where Java is required in order to function properly. Below you will find the easiest way to install Java Runtime and if you are into Development of Java Applications the Java JDK.

Let’s start:

  1. Open a Terminal
  2. Type the following command in order to download the necessary packages for Java Runtime
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    and click Enter

  3. Type Y to confirm the download and the process will start downloading and installing the packages
  4. When it’s finished type the following to test the version you just installed and if it’s properly installed:
    java -version
  5. OK, now you have your Java up and running :P If you are a developer and want the Sun Java JDK too just type the following command:
    sudo apt-get install sun-java6-jdk

    Confirm the download and you will be ready to start coding!!!

If you want to test your version online just visit Java check site:

Java Runtime Verification Site

@ Developers
I highly recommend you the Eclipse (supports Android Plugin) and NetBeans IDEs.

@ Problems and Issues
If you get a message that those packages do not exist you should enable partner repositories in your system.

Applications -> Ubuntu Software Centre
Edit -> Software Sources

Ubuntu Software Tab
Make sure the following options are ticked:

  • Canonical supported Open Source software (main)
  • Community maintained Open Source software (universe)
  • Proprietary drivers for devices (restricted)
  • Software restricted by copyright or legal issues (multiverse)

If you want change the ‘Download from:’ mirror to one that is closer to your location.

Other Software Tab
Make sure the following options are ticked:

  • Canonical Partners
  • Canonical Partners (Source Code)
  • Independent
  • Independent (Source Code)

Manual Edit sources.list (if you don’t do the above)
If you want to manually edit the sources just open a terminal and type

sudo gedit /etc/apt/sources.list

Now you can UNCOMMENT the repositories you want by removing the “#” symbol at the beginning of line. (Notice: enable BOTH deb & deb-src if you enabled any repository)
MANDATORY next step:

sudo apt-get update

It’s tested in Ubuntu 11.04 . . If you have any problems comment and I’ll try to help you ;-)