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

    Yes, Les, thanks for that. Just what I needed too.

    [Reply]

  2. Helen says:

    I have followed the above instructions and Java was installed no problem. When I go to yahoo games it says I don’t have java. What am I doing wrong?

    Thanks
    Helen

    [Reply]

  3. admin says:

    try to run the following command in your firefox

    about:plugins

    and check java plugin is showing or not

    [Reply]

  4. Helen says:

    Hi
    Yes the java plugin is showing

    [Reply]

  5. Jorge Millares-Bobet says:

    when i do it(pasted sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts) it said that the installer sun-java6-jre can not be found, what should i do =S
    please help me

    [Reply]

  6. Jorge Millares-Bobet says:

    also i tried the
    /etc/apt/sources.list file
    and it said

    /etc/apt/sources.list file
    bash: /etc/apt/sources.list: Permission denied

    [Reply]

  7. Prast says:

    Help me please, I’m totally nob.

    I try to run “about:plugins” in my firefox but java plugin is not showing

    Thanks before.

    [Reply]

  8. dave says:

    @prast

    try this

    Check your java version.

    java -version

    In my case is the last one from the Ubuntu repo:
    1.6.0_05

    Configure java with the following command

    sudo update-alternatives --config java

    Now go to /usr/lib/jvm/java-6-sun/jre/bin/java

    Run the following command from terminal

    sudo sed -i ‘s/XINERAMA/FAKEEXTN/g’ /usr/lib/jvm/java-6-sun-1.6.0.05/jre/lib/i386/xawt/libmawt.so

    Delete all links

    sudo rm -r /usr/lib/firefox/plugins/libjava*

    sudo rm -r /usr/lib/firefox-plugins/plugins/libjava*

    sudo rm -r /usr/lib/firefox-3.0b3/plugins/libjava*

    Reconfigure alternatives

    sudo update-alternatives --all

    Leave everything as default except for

    rmiregistry
    java
    keytool
    rmid
    orbd

    All of these entries must have /usr/lib/jvm/java-6-sun/jre/bin/ as alternative

    From the terminal refresh java shortcuts

    sudo update-java-alternatives -s $(update-java-alternatives -l | cut -d’ ‘ -f1)

    Then re-create java shortcuts for Firefox(es):

    sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.05/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/

    sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.05/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox-plugins/plugins/

    sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.05/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox-3.0b3/plugins/

    Now open Firefox, type about : plugins in the address bar and java should be there

    [Reply]

  9. Weez says:

    Hi,

    To accept the license, I click on F12.

    I have ubuntu feisty fawn installed with current updates. I used your terminal command which installed the .deb file. I can use java in both Firefox and my default browser Swiftweasel. But,

    When I type in java -version, I get the following:

    The program ;java’ can be found in the following packages:
    jsrel.4, gij-4.1, kaffe, jamvm java-gcj-compat, cacao, sablevm,
    bash: java: command not found.
    When I do a search for ‘java’ file in system, I have links (broken) in the following for /etc/alternatives, for java, javaws,javaws.1.gz java_vm. And links (broken) in /usr/bin for javaws, java, java_vm, and link (broken) in /usr/share/man/man1 for javaws.1.gz and java.1.gz

    [Reply]

  10. Clay77 says:

    Hi,

    I can’t seem to get firefox to recognize Java. I’ve installed the plugin and tried your instructions above, but when I make the sym link it comes up as a broken link…any ideas why that’s happening?

    Many thanks!

    [Reply]

  11. gh423 says:

    I also could not get firefox to use sun-java. I tried a lot of ideas from forums, etc. It finally started to work after running:

    sudo update-alternatives –config xulrunner-1.9-javaplugin.so

    and selecting the line for sun java. This was using sun-java6.

    I found this by running “update-alternatives -all” and selecting everything that looked like sun java. The above was the only one that I found that had not already be set to a sun java with –config java” and “–config jre”

    [Reply]

  12. rams k. says:

    Can anyone please tell me how to install JRE for IE in ubuntu?
    Thank you…

    [Reply]

  13. Auron says:

    look im trying to run runscape for 3 months so pls if u have a guide pls tell me thank u

    [Reply]

  14. Nadeem says:

    If some one is stuck at license page. He should follow these steps.
    1- Press the tab key, control will go at
    2- Then press enter key

    [Reply]

  15. Tim Silver says:

    Ubuntu 8.04

    Guide worked absolutely fine for me – but I’m glad I read the bit about using the arrow down key and tab key on the licence page.

    [Reply]

  16. xirius says:

    I’m Mr. “no idea of installation”
    i,m also a noob in this kind of situation and i think this problem would be very simple to answer….

    when i started to open the package it says:
    “dependecies not satisfiable” then a name of an anther software next to it(e.g. jdk bla bla bla)…
    what will i do

    [Reply]

  17. xirius says:

    ca n u guys help me???

    [Reply]

  18. David Turner says:

    I just installed Ubuntu. Never used anyother opperating system before. I can see why. The last time I had trouble installing stuff was back in Win 95 days. However I will persist and learn. Just wish it was easier to install stuff.

    [Reply]

  19. Casey says:

    Gh423 in comment 41 had the final key for me as well. I’m running hardy and firefox 3. There is a test applet for seeing your results.

    Thanks everyone.

    [Reply]

  20. zack says:

    I just started using linux for the first time today and im loving its versatility, but i really dont know how to install anything i know i probably shouldn’t be posting here, but you guys seem to really know the OS so i was wondering if you could point me towards a site that could teach me all the stuff i need to know to use Ubuntu properly.

    [Reply]

  21. Nakul says:

    Can anyone help with this.someone else also posted the similar one but i didnt find any solution to it.

    The program ‘java’ can be found in the following packages:
    * java-gcj-compat-headless
    * openjdk-6-jre-headless
    * j2re1.4
    * kaffe
    * cacao
    * gij-4.1
    * jamvm
    * gij-4.2
    * sablevm
    Try: sudo apt-get install
    bash: java: command not found

    i dont know how to add the java javac and commands like this to run in terminal. Thanks

    [Reply]

  22. wikidkaka says:

    #51: if you are using ubuntu just run the following in the given order

    $ sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
    $ sudo update-java-alternatives -s java-6-sun
    and then add the line below at the start of /etc/jvm file
    /usr/lib/jvm/java-6-sun

    the commands should work for other distros too. But am not sure if they come with an update-java-alternatives utility

    [Reply]

  23. someone help meeeeeeeeee! says:

    hey everyone
    i only want to download javaaaaaaa!
    any kind the 6 or the 5 or w/e just need some help cuz when i download it.. it doesnt do anything!!!
    is it my internet or something!?

    [Reply]

  24. Ben says:

    #52: THANK YOU! That “sudo update-java-alternatives -s java-6-sun” totally fixed my CLI java.

    [Reply]

  25. Gary E. says:

    OMG…How simple was that!

    Keith S-C
    “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!”

    Me To… Oh Brother!

    Thanks Keith for the input. I was hitting everything on the keyboard that had to do with the term.
    Boy do I feel like a dummy. :(

    [Reply]

  26. Gary E. says:

    By the way all of this to look at the radar maps on the National Weather Service’s site nws.noaa.gov or
    http://radar.weather.gov/Conus/index_loop.php

    We are in our hurricane season now in Florida an I rather be seeing a Java based moving image then a static one.

    [Reply]

  27. This was about the most trouble free install guide for Java that I’ve found. It went without a hitch.

    [Reply]

  28. Robert Howard says:

    I am trying to install java 1.6 downloaded from Sun. Following their directions on how to install it, I keep getting “no such file or directory”. can one of you please help out a newby?
    Thanks

    [Reply]

  29. freax says:

    @ 58: I’m newby too and got it working through this link: http://openjdk.java.net/install/

    For me, this worked fine, after I first followed the steps of comment #52, but could not save changes to ‘/etc/jvm file’
    (and it seems that’s a necessity to get it working)

    Well, then I just followed the steps here: http://openjdk.java.net/install/

    et voila, all works fine now. good luck

    [Reply]

  30. hamid says:

    hay guys,
    I am trying install Java Runtime Environment JRE.. this the commmand i use … sudo apt-get install sun-java6-jre.. this what i get
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Couldn’t find package san-java5-jre
    does any1 got any idea whats that mean..

    [Reply]

Leave a Reply