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


  2. try to run the following command in your firefox


    and check java plugin is showing or not

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

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

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

  5. Help me please, I’m totally nob.

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

    Thanks before.

  6. @prast

    try this

    Check your java version.

    java -version

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

    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-

    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


    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- /usr/lib/firefox/plugins/

    sudo ln -s /usr/lib/jvm/java-6-sun- /usr/lib/firefox-plugins/plugins/

    sudo ln -s /usr/lib/jvm/java-6-sun- /usr/lib/firefox-3.0b3/plugins/

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

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

  8. 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!

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

    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”

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

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

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

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

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

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

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

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

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

  19. #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

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

  20. 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!?

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

  22. 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. 🙁

  23. 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?

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

Leave a comment

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