April 15, 2007 · General · Email This Post

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

Incoming search terms:

Related posts

153 Comments to “How to Install Java Runtime Environment (JRE) in Ubuntu”

  1. OliBlogger says:

    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?

    [Reply]

  2. admin says:

    thank you OliBlogger i have updated the correct ouput and java6 only not java6u1

    [Reply]

  3. samol says:

    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″

    thanks

    [Reply]

  4. Martin says:

    Yes, but you have to set Sun’s Java as default java.

    [Reply]

  5. samol says:

    Got it. thank you.

    [Reply]

  6. sunny says:

    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?

    [Reply]

  7. admin says:

    @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

    [Reply]

  8. Jay A. Babcock says:

    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.

    [Reply]

  9. Jay A. Babcock says:

    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

    [Reply]

  10. sid says:

    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

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

    any1 know whats up?

    [Reply]

  11. admin says:

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

    [Reply]

  12. sid says:

    ahh ok changed and works!

    thanks admin

    [Reply]

  13. Anthony says:

    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.

    [Reply]

  14. Arun Kumar says:

    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!

    [Reply]

  15. Arun Kumar says:

    Problem went away by itself… The software update feature in Ubuntu kicked in and gave me Java 1.6!

    [Reply]

  16. Jørgen says:

    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?

    [Reply]

  17. Jørgen says:

    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… :(

    [Reply]

  18. Jørgen says:

    nevermind, was a bit to hasty… :)

    [Reply]

  19. Ahmed Ragab says:

    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

    [Reply]

  20. Ahmed Nabhan says:

    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

    [Reply]

  21. Keith S-C says:

    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!

    [Reply]

  22. harry says:

    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.
    Bye.

    [Reply]

  23. frustrated noob says:

    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.

    [Reply]

  24. Grog says:

    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?

    [Reply]

  25. Duane says:

    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!

    Duane

    [Reply]

  26. Kaikai says:

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

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

    [Reply]

  27. Kaikai says:

    Hi

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

    [Reply]

  28. Tom J says:

    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

    [Reply]

  29. Les says:

    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

    [Reply]

  30. ice says:

    Thnx Les! My java also pointed to the old version, but not anymore :)

    [Reply]

Leave a Reply