Howto install Sun Java Runtime Environment (JRE) in Ubuntu 10.04 (Lucid Lynx)

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.

We have already posted about sun java was moved to the Partner repository in Ubuntu 10.04 (Lucid)

Procedure to follow

Open terminal and run the following commands

Add partner repository using the following command

sudo add-apt-repository "deb lucid partner"

Update the source list

sudo apt-get update

Now install sun java packages using the following commands

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

The above command will download all the required 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

Sponsored Link

Related posts

127 thoughts on “Howto install Sun Java Runtime Environment (JRE) in Ubuntu 10.04 (Lucid Lynx)

  1. I installed ubuntu today and have spent countless hours trying to find the answer to this problem. My gratuity in immeasurable. Thank you so much.

    Even if I was just making some rookie mistake.

  2. Re: Why not use the free (gpl) openjdk?
    Because it isn’t as good. Try running a java application
    (ex: jdownloader,
    first under openjdk, then under sun-java, and see for yourself.

  3. @jkl
    “Why not use the free (gpl) openjdk?”

    I have found that openjdk eats up way more resources than sun.
    I gave openjdk a nice run. Used it exclusively for about a month and a half. So many times java would be killing my resources. I changed to sun and the usage went down a lot.

  4. Does not work. Received following error message:

    [email protected]:~$ sudo add-apt-repository “deb lucid partner”
    Error: need a repository as argument
    [email protected]:~$ sudo add-apt-repository “deb lucid partner”sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    Error: need a repository as argument
    [email protected]:~$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    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
    [email protected]:~$

  5. @Victor: I had the same problem, but it’s easy to solve. If you used copy&paste (like I did), you just have to replace the original quotation marks (which have the wrong ascii-code) with the standard quotation mark on your keyboard. On the german keyboard, it’s above the “2”, I don’t know where it is on english ones…


  7. Just want to thank the developers for their effort-a couple of comments, however. (You’ll want to confirm that your system is configured properly for Sun’s JRE. This is a two-step process.) Only one step is listed-what is the second? Also not stated was the necessity of removing all components of open java first.

  8. @Dan
    You dont need to remove OpenJDK
    Finalize the process by running this command:

    See what you are currently using:
    java -version

    List available alternatives:
    sudo update-java-alternatives -l

    Change to Sun:
    sudo update-java-alternatives -s java-6-sun

    (change back with:
    sudo update-java-alternatives -s java-6-openjdk)

  9. You also want to install sun-java6-demos
    This will require and install sun-java6-jdk

    Which will make sudo update-java-alternatives -s java-6-sun work without errors.

    ie without sun-java6-jdk I received errors as follows:
    update-alternatives: error: no alternatives for appletviewer.
    update-alternatives: error: no alternatives for apt.
    update-alternatives: error: no alternatives for extcheck.
    etc etc etc

  10. I still think one of the firs things people should do when they get things up is install the ubuntu-restricted-extras package.


  11. Drewsus: thanks for the info-next time that’s what I’ll do; everything now seems to be fine-I just uninstalled everything to do with open-java including plugins and then reinstalled sun-java. I forgot to mention after installing sun-java the first time when I ran java -version it showed open-java. I don’t think I need both?

  12. What about Firefox? Does this procedure also install the Java plug-in for Firefox 3.6.x? It didn’t in Ubuntu 9.10.

  13. @ Bob-El
    I had no problems in Lucid, but this is what I did in Karmic to fix that (you might need to change paths a bit):
    ln -s /usr/lib/jvm/java-6-sun- $HOME/.mozilla/plugins/

    But shouldn’t be required in Lucid.

  14. After doing a clean install of either Ubuntu or Xubuntu 10.4 on several machines found that Java was not installed by default. Best and easiest way to install was to enable “Partner” repositeries as per one of the suggestions posted here. After reloading/refreshing available packages the Sun-Java packages and web plug-in are available and can be installed from the package manager. I did initially try the terminal suggestions posted here but was unable to find a place to accept the disclaimer within “Terminal” so that install could continue within the terminal program requiring some back and fourth between terminal and package manager to get things working.

    Thanks for all the responses to my question.
    Hope this helps.

  15. @Victor
    the ‘tab’ and ‘enter’ keys are your friends when accepting that disclaimer in the terminal

  16. I get this error after “sudo apt-get update”:
    E: Malformed line 54 in source list /etc/apt/sources.list (dist parse)
    Please help.

  17. I have same problem as VJ. But VJ’s second post says “resolved”

    Please tell me how was problem was resolved.

    VJ says:
    May 3, 2010 at 8:32 pm

    I get this error after “sudo apt-get update”:
    E: Malformed line 54 in source list /etc/apt/sources.list (dist parse)
    Please help.

    VJ says:
    May 3, 2010 at 11:22 pm


  18. Frank, I got the idea from here:
    The sources.list needed to be edited. In my case that line (54) needed to be deleted.
    To edit the file I used something like “sudo gedit /home//etc/apt/sources.list”.
    This allowed me to open the file in gedit editor with admin permissions. Otherwise if you open it straight from the file manager it won’t let you save it after editing is done.

  19. I get to the last thing grey page to accept terms it only says ok i hit enter i cannot accept the terms!! HEPL!

  20. Hepl is on the way!
    Like I said earlier, use the tab key to move around

  21. thank you, this was exactly what i needed to find

    i recently upgraded from karmic and my java was not usable.

    thanks for posting this

  22. I love you. I found that demos package does not exist for some reason. Installed jdk and now its perfect.

    Why not openjdk ?

    The following applet does not work at all on open jdk, fxgame/trade java applet at

    A good test as all their trouble shooting apps work. As soon as you hit openjdk with a complex app: SPLAT.
    Thanks for post

  23. Thanks, solved my problem, which was accessing ADFFN monitor page. Necessary to read comments so if you’re reading this then I hope you’re ok.

Leave a comment

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