How to Install Java Runtime Environment (JRE) in Ubuntu

Sponsored Link
Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s. Java applications are compiled to bytecode, which at runtime is either interpreted or compiled to native machine code for execution.

The language itself derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. JavaScript, a scripting language, shares a similar name and has similar syntax, but is not directly related to Java.

Currently Ubuntu has the following Java packages

sun-java6-bin -- Contains the binaries

sun-java6-demo -- Contains demos and examples

sun-java6-doc -- Contains the documentation

sun-java6-fonts -- Contains the Lucida TrueType fonts from the JRE

sun-java6-jdk -- Contains the metapackage for the JDK

sun-java6-jre -- Contains the metapackage for the JRE

sun-java6-plugin -- Contains the plug-in for Mozilla-based browsers

sun-java6-source -- Contains source files for the JDK

Installing the Java Runtime Environment

First you need to check multiverse repository enabled or not after that open a terminal window. Since you are going to be installing the JRE and the web browser plug-in, you'll be using the following command from a terminal

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

Once it downloads the packages and begins the installation, you'll get a screen that contains the Sun Operating System Distributor License for Java and hit Enter to continue. You'll see a dialog that asks you if you agree with the DLJ license terms. Select Yes, and hit Enter; the JRE will finish installing.

Testing Java Runtime Environment

You'll want to confirm that your system is configured properly for Sun's JRE. This is a two-step process.

First, check that the JRE is properly installed by running the following command from a terminal.

java -version

You should get similar output

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Testing Java Plugin for Firefox

open Firefox and typing about:plugins in the address bar and check for java plugin

Sponsored Link

Related posts

153 thoughts on “How to Install Java Runtime Environment (JRE) in Ubuntu

  1. That’s odd.
    When you installed sun-java6-* I do not expect java -version to give
    Java version “1.5.0_08?
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)

    but more something like
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

    I do have a question though: Is Java 6 or Java 6U1 (6 update 1) installed?

  2. It’s 3″30 and i just installed sun-java6-.
    When I run java -version I get:

    java version “1.4.2-02”
    Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-02)
    Java HotSpot(TM) Client VM (build Blackdown-1.4.2-02, mixed mode)

    Should I not get Java version “1.6.0”


  3. when i configure jre on my ubuntu, a blue print is shown ,something like sun license,but no any more response.i don’t know why?
    then i type
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    in a new terminal,there is:
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

  4. @sunny

    you are running another apt-get process you can check this using

    ps -ef

    look for apt-get process number and kill the process using the following command

    kill -9 processid

  5. OK – here’s what I had to do.Put:

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

    into terminal and it stalled when I got a blue screen. Then I went to Synpatics Package Manager where I got a message about a broken package, it had instructions on what to do from the terminal, did that

    Ran the terminal command again adn this time it went through. Then ran it a third time to get the browser plug-in.

  6. EDIT
    after using dpkg –configure -a
    I restarted Synaptics and found JRE in the Installed (upgradable) section and that worked to install (clicked Apply)

    I now had the JRE updated, but stil no browser plug-in, so I ran
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    a second time and it installed the plug-in

  7. im a serious noob at this stuff so bare with me

    when im in the terminal and i type in

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

    i get

    Reading package lists… Done
    Building dependency tree… Done
    E: Couldn’t find package sun-java6-jre

    any1 know whats up?

  8. you need to make sure you have enables universe,multiverse repositories in your /etc/apt/sources.list file

  9. I have the version 1.6.0 loaded, how do I get the update? I am trying to work a Ubuntu 7.04 machine for my wife, she wants to play on the Pogo website and it’s a no go. It says I need the most current version of Java runtime.

  10. Like others, I am getting stuck with the blue screen showing the Sun Java license agreement. I have no idea how to “accept” this license: there doesn’t seem to be any button to click, and I have tried the Return, Y (for Yes), O (for OK) and spacebar but there doesn’t seem to be any way to close the dialog and continue with the installation. Any tips would be appreciated (I am clueless about what I am doing!)

    P.S. to make things a little more complicated, I am running Ubuntu as a virtual OK on my Mac Book Pro using Parallels!

  11. I did as instructed but nothing happened when i pushed “enter” in the bluescreen. I then closed the window and ran the command again but then got the following message: E: dpkg was interrupted, you must manually run ‘dpkg –configure -a’ to correct the problem.

    Anyone know what went wrong and what i can do to fix this?

  12. I actually got the same error message when i tried to open Synaptic package manager too, making it impossible to run. Hope someone can help me with this, i’m a linux noob… 🙁

  13. I just got the license agreement blue screen without any input key. But when I restarted the installer apt-get requesting to install j2sdk package, I managed to accept the license of j2sdk by a message box with yes / no buttons. but now I am stuck at the java6 license agreement which does not include an action button to accept the license. Any one have an idea about how to solve this problem

  14. A strange thing happened now. when I used the down arrow key until it sets the focus on and pressed Enter, it shows up a yes/no message box through which I was able to accept license of java6

  15. I had the same problem. I scrolled all the way to the bottom and then clicked on TAB to get the button to be highlighted. This took me a long time to figure out!

  16. Oops my Java comments should have been Here.
    I have Ubuntu 6.06 now and went to Sun’website to download java for Linux….curiously they appear to do versions for RedHat and others, but not Ubuntu.
    I can’t get my head round repositories and other stuff…perhaps I should have looked there first and then done what was shown in #10,#11’#12 (above). Clearly, I still need a step-by-step guide.

    In the past I’ve groaned about .PDF’s – but now 6.06 reads them!
    Ah, printers next….after JAVA, which I need for streaming prices on websites I visit. Curiously under Win98SE/IE5 the latest Java messes up, so I have to block it and resume with the earlier version that came bundled…..I don’t understand……what is Java and how does it run under another OS? Probably best to stay ignorant…..but I’d like to have the streaming prices under Firefox.

  17. I had the same problem as someone else. I also recieved the message telling me the sun-java6-jre couldnt be found. I noticed there was a response, and I had done what the person said. I still seem to be getting the same error….I’m not even sure what version of ubuntu i have, If anyone could help me figure out what I’m missing I’d really apprciate it.

  18. Well this worked great for me…

    However, I was wondering how I might go about installing Java 6 Update 2? There is a security fix in it I’d like to have.

    Similar method?

  19. Hi,

    Use the down arrow until you reach the bottom, then use the tab key to move the cursor to highlight the OK, then hit enter, do the same on the next screen that pop ups up too, should work fine every time. This is often standard for these types of installs…

    Hope this helps!


  20. Hi for the blue screen I found how to fix it.

    I closed the terminal, launched another terminal and typed “dpkg –configure -a”

  21. Hi

    In fact you should install it through Synaptic Package Manager. It will allow you to installl it

  22. Frist, you have to close Firefox, or it won’t work.

    Then, I got this message: Use of uninitialized value in print at /var/lib/defoma/scripts/gs.defoma line 108

  23. For people have problems with their java coming up with an old version after you install the new 1.6, do the following from a root shell:

    > update-java-alternatives -s java-6-sun

    This will change the Java engine over to the new version.

    You can check the installed version or change with:

    > update-java-alternatives -l

    ..which will give you output similar to:

    java-6-sun 63 /usr/lib/jvm/java-6-sun
    java-gcj 1041 /usr/lib/jvm/java-gcj

Leave a comment

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