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. Sundar says:

    Hi, I am VERY new to Ubuntu (first run). I have Ubuntu 10.04 and I tried the steps above, but when I typed these into the Terminal..It said:

    Package sun-java6-jre is not available but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source.

    I have no idea what to do. Any help please?

    [Reply]

  2. oOze says:

    sun-java6-plugin has been replaced by icedtea6-plugin.

    So install icedtea6-plugin ‘sudo apt-get install icedtea6-plugin’

    [Reply]

  3. oOze says:

    Installing java has a different name too:
    openjdk-6-jre

    [Reply]

  4. Sundar says:

    OK, thanks alot.

    [Reply]

  5. Texco says:

    I keep getting this problem…

    Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main tzdata 2010j-0ubuntu0.10.04
    404 Not Found [IP: 91.189.88.31 80]
    Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main tzdata-java 2010j-0ubuntu0.10.04
    404 Not Found [IP: 91.189.88.31 80]
    Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2010j-0ubuntu0.10.04_all.deb 404 Not Found [IP: 91.189.88.31 80]
    Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata-java_2010j-0ubuntu0.10.04_all.deb 404 Not Found [IP: 91.189.88.31 80]
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

    I cannot not find the tzdata-java_2010j-0ubuntu0.10.04_all.deb file anywhere… even in there tzdata archives…

    [Reply]

  6. Aryan says:

    Should I remove OpenJDK after installing JRE in ubuntu lucid? :-?

    [Reply]

  7. Hannah says:

    HEy Thanks for info. I am waiting for next ubuntu. currently using 10.04. @aryan OpenJDK dont need to remove. YOu can chose the sun jdk or jre from option.

    [Reply]

  8. Trevor says:

    I ran this in 10.04, and it ran correctly, however, when the screen about the operating distributor license comes up, I can’t get off it. The only button I can press that does anything is the down arrow, and once I’m to the bottom of the agreement, nothing happens. Does anybody have an idea of what happened?

    [Reply]

  9. golan says:

    I have same problem as Sundar: using a virtual machine Ubuntu 10.4 and it doesn’t find the packages mentioned in the article. An update might be in order ;) ?

    [Reply]

  10. lilkersy says:

    where can i download jre and jdk without it being from the ubuntu software center…

    [Reply]

  11. shiv says:

    Hi

    I also faced the same license page hanging issue for a long time in ubuntu 9.10. But was able to get over it by just pressing ‘Tab’ key. ‘Ok’ was made visible and clicking ‘Enter’ did the magic!

    I know its a late reply but hope it helps :)

    [Reply]

  12. Chuck Ishman says:

    OMG!!! I love it when the code works! I also ran into the same problem with “Package sun-java6-jre is not available but is referred to by another package.” The post by oOze corrected my problem. Thanks to all who posted the code that worked for them. It seems to do the trick. I would suggest this as an update:

    sudo apt-get install openjdk-6-jre-headless sun-java6-plugin sun-java6-fonts

    [Reply]

  13. Dorbah says:

    I try to install these from .deb packages, but can’t do this because it has recursive dependences and I just add repository in sources.list, then update list in Synaptic, search needed packages by “sun-java6″, check for install sun-java6-jre, sun-java6-plugin and sun-java6-fonts – now all OK.
    Thanks for guide

    [Reply]

  14. kuyshaypot says:

    ubuntu10.4

    [Reply]

  15. Don’t forget the apt-get update after adding the new repository.

    [Reply]

  16. cSquall says:

    Good posting. I managed to get the plugin to work, but from what’s in this thread, I’ll go back and check to make sure that the rest of the packages installed correctly.

    Regarding the plugin — remove the icedtea plugin and the Sun Java won will then appear — they can’t be there concurrently, even if you have disabled the icedtea. At least that’s how it worked for me…

    [Reply]

  17. Curt says:

    RE Chuck Ishman
    This command worked , it was slow d/l from wifi

    sudo apt-get install openjdk-6-jre-headless sun-java6-plugin sun-java6-fonts

    [Reply]

  18. Chris says:

    I’m at the point where I have to agree to the DLJ terms, and there is no yes for me to select. There is an OK at the bottom, except I can’t click on it. Can anyone help me with this.

    [Reply]

  19. cSquall says:

    @Chris: Try pressing the spacebar to select the “OK”, then press enter. I think that’s what I did…

    [Reply]

  20. illucypher says:

    @Chris and cSquall

    press the TAB key to activate the then click enter

    [Reply]

  21. divya singh says:

    hw to check whether java is installed???

    [Reply]

    admin Reply:

    try to use the following command from terminal

    java -version

    [Reply]

  22. Omar says:

    How to enable Java in Mozilla 3.6.16 ?

    I went through Edit-Preferences and i couldn’t find any thing related to ‘Java enable’

    [Reply]

  23. Wilfredo says:

    To install java on Ubuntu. Is very simple. Do this.

    Type in the terminal windows this line

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

    then hit y for “yes” and press enter and automatic start to install the java pluging

    [Reply]

  24. Trojan Abba says:

    I don’t have a GUI on my Ubuntu server, but wanted a Minecraft server running. To install Java, I opened up a Screen and entered

    sudo apt-get install sun-java6-jre

    In the process, it popped up a “dialog” asking me to accept the license, but there was no way to respond to the dialog — probably due to the license being too many words to fit in the screen.

    I opened up another Screen, and found the apt-get process, then followed it’s children until I found a whiptail process that was responsible for presenting the dialog. I killed that process.

    The install then popped up another, smaller, dialog (something to the effect of ‘you must accept the license…’) that I COULD respond to, and the install succeeded after that.

    [Reply]

  25. Paul R. says:

    It worked, Trojan, thanks!!

    ps -fe | grep whiptail
    kill #######

    [Reply]

  26. Max says:

    The above (sudo apt-get install sun-java6-jre) does not work for me:
    # sudo apt-get install sun-java6-jre
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package sun-java6-jre is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘sun-java6-jre’ has no installation candidate

    OTOH, I would appreciate a hint on WHICH of the JRE’s (listed e.g. when you do “apt-cache search jre”) to install (differences) ?

    The standard-jre would download 50MB, the gcj-jre only 20MB.

    [Reply]

  27. Alex says:

    Hi,
    I am using Xubuntu 10.10 and Google Chrome as browser. I installed the version 20 from Ubuntu Software Center, IcedTea, OpenJDK runtime and web start. It seems even today the version I got is still 20. However some companies in Singapore had upgraded their website and you need version 26. If the Ubuntu Software Center has not updated their Java package how can I upgrade to version 26?

    [Reply]

  28. Alex says:

    I missed out the adding new repository. Please advise me on this I am very new to Xubuntu 10.10

    [Reply]

  29. Kevin Audleman says:

    You might also want to install the full Java Development Kit, which can be done so:

    sudo apt-get openjdk-6-jdk

    One thing this gets you is the jar command for creating/modifying .jar files.

    [Reply]

Leave a Reply