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

Incoming search terms:

Related posts

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

  1. If you want to install java5 use the following command

    error :- E: Couldn’t find package san-java5-jre

    package name sun-java5-jre not san-java5-jre

    sudo aptitude install sun-java5-jre

    If you want to install java6 use the following command

    sudo aptitude install sun-java6-jre

    [Reply]

  2. when entering
    ./jre-1_5_0_08-linux-i586-rpm.bin
    in my bash script
    what can i add to it to accept the licencing agreement
    it must be in the bash script to enter yes.

    thanks

    [Reply]

  3. Ubuntu gurus help. I tried running java runtime environment on my laptap (fujitsu lifebook A series) and all seemed to go well until I get the screen that said to select ‘yes’ which I screwed up and closed the screen because I didn’t think it responded.

    I tried running “dpkg –configure -a” and I get this:

    dpkg: need an action option

    What am I doing wrong? Please help.

    [Reply]

  4. Thanks, guys! I got my java working again.

    I’m on Hardy and had Open JRE which was broken. All I got was a grey box at java.com’s java test.

    I tried the installing as according to the initial instructions at the top of the page but only the missing files were added.

    But the java test still did not work.

    Then I followed Les’ advice on message 39 and did the update for java.

    Now java works fine for me now ;)

    [Reply]

  5. Hello every1,

    8,10 beta version

    when i type the command sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts i get the following message:

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    sun-java6-jre is already the newest version.
    sun-java6-jre set to manually installed.
    Package sun-java6-plugin 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-plugin has no installation candidate

    universe and multiverse repositories are enabled.

    I have installed the newest java version from the synaptic,but still i cant see the plug in at firefox and i cant run some application that need java,

    P.S.i am new to linux ,
    thanks

    [Reply]

  6. after I run command sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    E: dpkg was interrupted, you must manually run ‘dpkg –configure -a’ to correct the problem.
    What`s the problems?

    [Reply]

  7. And after I runed Synaptic manager this message showed:

    E: dpkg was interrupted, you must manually run ‘dpkg –configure -a’ to correct the problem.
    E: _cache->open() failed, please report.

    what can I do with this problem?

    [Reply]

  8. I accidentally terminated the terminal while the installation is incomplete.

    I tried to run again “sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts” but I got this message:
    E: dpkg was interrupted, you must manually run ‘dpkg --configure -a’ to correct the problem.
    What will I do? I’m a newbie in Ubuntu.

    [Reply]

  9. I read that the Java Plugin doesn’t exist in for X64 Linux, but you can use the 32-bit Java Plugin for Firefox. I am running Ubuntu x86_64 Hardy Heron.

    sudo update-java-alternatives -s java-6-sun

    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/java’ to provide ‘java’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/lib/jexec’ to provide ‘jexec’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/keytool’ to provide ‘keytool’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/orbd’ to provide ‘orbd’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/pack200′ to provide ‘pack200′.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/policytool’ to provide ‘policytool’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/rmid’ to provide ‘rmid’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/rmiregistry’ to provide ‘rmiregistry’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/servertool’ to provide ‘servertool’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/tnameserv’ to provide ‘tnameserv’.
    Using ‘/usr/lib/jvm/java-6-sun/jre/bin/unpack200′ to provide ‘unpack200′.
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so
    update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-sun/jre/plugin/amd64/ns7/libjavaplugin_oji.so

    [Reply]

  10. I installed successfully jdk 6 using Synaptic Package Manager. Now i want to install tomat, which requires JAVA_HOME variable to set. I don’t know where java is installed and what value should i gave to this variable. Can you guide me where java is installed by default?

    [Reply]

  11. It also makes a subdirectory of jre1.6.0_11
    I wonder if ubuntu or canonical even knows this or they must be having trouble getting sun to release a share to them?
    I had it working once but had to do a fresh reinstall so I lost it and don’t remember what I did to get it working but it will work with the latest ubuntu intrepid to.

    [Reply]

  12. I got the licence panel which froze the terminal as described by others and after several goes I eventually to restart the computer to clear the jam. Next time I simply ran the “sudo dpkg –configure -a” command and once that had cleared things, I installed from the synaptic package manager. A search for java highlighted two packages and I installed those. Everything went fine this time with a licence agreement window with a working check box to accept the licence and the installation completed OK. I was then able to install the mozilla plug in OK.

    I then ran the checks given in the initial instructions and all was OK.

    Sometimes installing from the terminal may not be the best option, but you don’t find out till you try :-)

    Geoff

    [Reply]

  13. Thank you for the instructions. Helped a lot. Though when I check in the terminal I see ‘java version “1.5.0”‘, while in firefox it shows Java 6.

    Can anyone tell me why this is happening?

    [Reply]

  14. Hi, I installed the following script as directed:
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    The installation completed without asking for Licence acknowledgement. After installation, I checked using
    java -version
    and got the following
    The program ‘java’ can be found in the following packages:
    * gij-4.3
    * java-gcj-compat-headless
    * openjdk-6-jre-headless
    * cacao
    * gij-4.2
    * jamvm
    * kaffe

    I tried to run the same script again, but the reply was
    sun-java6-jre is already the newest version.
    sun-java6-plugin is already the newest version.
    sun-java6-fonts is already the newest version.

    Can anyone pse help. I have been struggling with this installation for a few days now. My aim is to install ACME, following the ACME guide

    Thanks

    I am using ubuntu server 9.04 64bit amd

    [Reply]

  15. for accepting licence agreement;
    1.Click on “Tab”.
    2.Click on “Space Bar”.
    3.Confirm the second question with the same tip.
    4.Go on:)

    [Reply]

  16. @omfarka:

    Thank you very much, I nearly became crazy as I could not accept anything during the installation…

    [Reply]

Leave a comment

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