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 http://archive.canonical.com/ 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

You may also like...

127 Responses

  1. Ramiro says:

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

    Why not use the free (gpl) openjdk?

  3. Pazuzu says:

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

  4. dRewsus says:

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

  5. Victor says:

    Does not work. Received following error message:

    shela@shela-desktop:~$ sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    Error: need a repository as argument
    shela@shela-desktop:~$ sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    Error: need a repository as argument
    shela@shela-desktop:~$ 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
    shela@shela-desktop:~$

  6. Robert Seetzen says:

    @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. Karan says:

    Getting the same error too.

  8. Erick Linares says:

    I LOVE YOU THANX YOU SOOOOO MUCH IM A !@ YEAR OLD TRYING TO LEARN THIS NEW liNUX !)>0$ I DiD EVERYTHING BY MYSELf EXCTP THIS WAS THE HARDEsT I HOPE TO grow AND LEARN AND BE LIKE THE PEOPLE THAT ADD THIS THANK YOU SOOO!!!!!!!!!! MUCH <3

  9. Dan says:

    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.

  10. drewsus says:

    @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)

  11. OzFalcon says:

    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

  12. Brett Howard says:

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

    apt://ubuntu-restricted-extras

  13. Dan says:

    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?

  14. drewsus says:

    @Dan
    What you did was fine. Saves you space too.

  15. Bob-El says:

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

  16. drewsus says:

    @ 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-1.6.0.15/jre/lib/i386/libnpjp2.so $HOME/.mozilla/plugins/libnpjp2.so

    But shouldn’t be required in Lucid.

  17. Victor says:

    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.

  18. drewsus says:

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

  19. VJ says:

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

  20. VJ says:

    resolved

  21. Frank Boxall says:

    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

    resolved

  22. VJ says:

    Frank, I got the idea from here: http://ubuntuforums.org/archive/index.php/t-1084691.html
    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.

  23. Jason says:

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

  24. drewsus says:

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

  25. Aurangozeb says:

    Dear,
    Use (‘) sign in stead of (“) sign.
    Then it will work perfectly.

  26. Aurangozeb says:

    Use

    sudo add-apt-repository ‘deb http://archive.canonical.com/ lucid partner’

    in stead of

    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”

  27. michael crabtree says:

    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

  28. ec says:

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

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

  29. FEFO says:

    Thnx a lot, solved my problem =P

  30. Alexx says:

    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 Reply

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