ghacks Technology News

Install Java on Ubuntu 10.04

Let’s face it, although most operating systems don’t install Java by default, there are many applications that rely on this tool. The reasons for OSes to not install Java are many (mostly of the licensing flavor) and, at least with Linux, the installation process can be confusing (at best) or painful (at worse). To begin with – which do you install? You can install jdk, jre, blackdown…the list goes on and on. And do you install from the downloadable binary installer or is there a better way.

I am here to tell you, at least with Ubuntu 10.04, there is a simple way of installing Java. That’s is the purpose of this article. Of course I will also take this one step further and show you how to make Firefox aware of your java installation. With this installed you can go ahead and visit those java-is-required web sites, as well as build those web applications you need to serve up.

Installation

We are going to be installing Java with the help of apt-get so, as you can guess, we will be doing this from the command line. So fire up your favorite terminal window and get ready to work.

The first step is to add the necessary repositories to the /etc/apt/sources.list file. So open that file up with your favorite text editor and add the following line to the bottom of that file:

deb http://archive.canonical.com/ lucid partner

Now to update apt, issue the command:

sudo apt-get update

Once apt has completed its update, you are ready to install. The actual installation command is:

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

The above command should install everything you need for you to get your java on. During the installation you may have to “read” and “agree” to the licensing of the software. Do this or the installation will exit without completing. Once the installation is complete you are done. Right? Maybe. But, before you assume all is complete, let’s check our installation. The easiest way to test your installation is to issue the command java -version at which point you should see something like:

java version “1.6.0.20″
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)

That will tell you for sure Java is installed.

Hello Firefox!

Now it’s time to let Firefox in on the installation. This too is simple. From the same command line you installed Java in issue the command:

locate libjavaplugin

The above command should return numerous results. The result you are looking for will resemble /usr/lib/jvm/java-6-sun1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so.  Now that you know the path you need to create a link to this in the /usr/lib/mozilla/plugins directory. First change into the plugins directory with the command cd /usr/lib/mozilla/plugins and then create the link with the command ln -s /usr/lib/jvm/java-6-sun1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so. Now all you need to do is restart Firefox and then enter about:plugins in the address bar to see that Java is now enabled in your browser.

Final thoughts

Did I say it was going to be easy? Maybe that was a slight exaggeration. I realize that installing Java on Linux isn’t nearly as it is on Windows, but it is certainly do-able. And in some situations, a must do. I hope this has helped make that “do” a little more “able”.


Enjoyed the article?: Then sign-up for our free newsletter or RSS feed to kick off your day with the latest technology news and tips, or share the article with your friends and contacts on Facebook or Twitter.

Related Articles:

Update Java and remove old Java versions from your system
How to install Nagios on Ubuntu server
Java Error 25099 Unzipping Core Files Failed
Install LibreOffice on Fedora and Ubuntu
Java Update Addresses Critical Security Vulnerability



About the Author:

Author: , Friday May 21, 2010 -
Tags:, , , ,


Responses so far:

  1. J Moore says:

    Hi,

    Thanks for the article.
    I do have one correction:

    ln -s /usr/lib/jvm/java-6-sun-1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin.so

    There was a missing – as well as libjavaplugin.so for the link name.

    All the best.

  2. Arup says:

    When you enable parter repository, Java is available in software center along with Java plugin, its as simple as clicking on them. Also Open Java is default and is available for install in software center as well and doesn’t need enabling partner repository.

  3. Abdul Fatah Shieryar says:

    This topic was very useful, I wonder if you could tell how to install adobe flash player in Ubuntu 10.04 64 bit.

    Thanks

  4. Indian-Art says:

    “I hope this has helped make that “do” a little more “able”.”

    Oh yes, the instructions are lucid and specific.

    Thanks.

  5. hasintha says:

    Thanx it was usefull.

  6. jasray says:

    As I remember, Ubuntu Tweak has all of this covered.

    http://helpforlinux.blogspot.com/2009/04/5-things-to-do-after-installing-jaunty.html

    Same commands for 10.4

  7. Chris says:

    how do I fix this to make java work?
    ln -s /usr/lib/ure/lib/sunjavaplugin.so
    ln: creating symbolic link `./sunjavaplugin.so’: Permission denied

  8. Redraven says:

    Hi
    For 64 bit ubuntu you should use libnpjp2.so.

    chris;
    You need to be root. (Usually achieved by using ‘sudo’ as the first command)

  9. K-Bomb says:

    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

    What am i doing wrong!!!!!

  10. jasray says:

    Everything needed is in the Ubuntu Software Center as long as all the repositories are checked. Flash, Java, etc.–there’s no need to be using the CLI. Go back through the link offered above; forget that it says Jaunty; when you install, it will show the correct Lucid repositories (if you want the CLI). The other posts offer the same.

  11. MarkR says:

    Worked great for me – thanks!

    Oddly, I did only the steps through
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    and not only did command-line Java work, but also Firefox 3.6.3 knew how to run Java applets without any further action by me.
    And this was on Ubuntu 10.04.

  12. maDDin says:

    Thank you so much! I spent days before, trying to install this java plugin, now it works! :)
    Ubuntu 10.04, Chromium

  13. David Roberts says:

    Magic. Thank you. Clear concise instructions. Now I have my PC back. :-)

  14. The silence says:

    Wow!! Just amazing and simple steps, Just what I need, thnx!!!!!!!1

  15. pls refer me to download jdk and jre (java package) on ubuntu 10.04…. i dont know how to download and install java package ….

  16. i dont know how to download and install java package in ubuntu 10.04…now i have an internet connection in windows 7 os … i could like to download java package in windows os and install onto ubuntu os…. i reffered many webpages all pages shows only how to update latest version of java package . .. . ..

  17. jasray says:

    http://www.ubuntugeek.com/how-install-sun-java-runtime-environment-jre-in-ubuntu-10-04-lucid-lynx.html

    Here you go!

  18. Gustavo says:

    Great help. Thank you very much.

    Following this paragraph are a copy of the last few lines of my process per your instructions, please notice that the “locate” command did not return anything. However, after I restarted firefox, the plugin was there and it worked like a charm. I am new on Ubuntu and I see I have a lot to learn, so I appreciate your instructions, now I just need to understand what I did.

    ….

    Setting up sun-java6-plugin (6.20dlj-1ubuntu3) …

    Processing triggers for libc-bin …
    ldconfig deferred processing now taking place
    gustavo@gustavo-toshiba:~$ java -version
    java version “1.6.0_20″
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
    gustavo@gustavo-toshiba:~$ locate libjavaplugin
    gustavo@gustavo-toshiba:~$

  19. Russel says:

    Thank you. I appreciate the help.

    Please write me back if you would like to learn about UFirstFinancial.com

    Russel

  20. Russel says:

    Oh, I apologize, please delete the comment before the previous. I didn’t realize that it would be published. The other comment can be published.

  21. Yanis says:

    Thanks for the post. It’s totally do-able ;)

  22. Nathan says:

    Very good article. Clear and easy to follow.
    Thanks a lot!

  23. kishor says:

    IF U ARE LOOKING TO INSTALL JDK WITHOUT INTERNET CONNECTION.!

    IT IS POSSIBLE…!!

    IF DOWNLOAD IT FROM OTHER SYSTEM WHICH HAVE INTERNET…

    IT TAKE FEW STEPS TO INSTALL THAT..

    FOR MORE DETAILED STEPS PLEASE VISIT FALLOWING LINK:

    http://kishor15389.blogspot.com/2010/11/install-jdk-on-ubuntu-any-version.html

    I’M SURE IT DEFINITELY WORKS…

  24. Stanley Bob-Carl Ozoemena says:

    I have followed each of your steps one-by-one. I have verified my installation. Everything seems AOK, except that when I go to Keepvid.com and try to download a youtube video, I’m still informed that I don’t have Java installed. I use Lucid Lynx with Firefox. I wonder whether there’s still something that I haven’t done…

  25. Stanley Bob-Carl Ozoemena says:

    Oops! What a pleasant surprise! It’s working! All I had to do was close all Mozilla windows, and retry/reload the page! :0) Yipee!!

  26. Stanley Bob-Carl Ozoemena says:

    I forgot another itsy bit of open source knowledge to add to the global brain via this article (and accompanying thread…)
    Well, you have to be a little patient and allow the bytecode to run via the JVM/JRE. You might have to wait for a minute for Mozilla to work. Even when ‘Done’ is displayed on the status bar, it ain’t ‘done’! It’s still working in the background — fetching your data for you. Just wait a while. The message on the screen that you’ve encountered an error is false — it’s working. :0) So have a little hacker’s patience, programmers! Ciao!

  27. write says:

    its done, so easy. thank you for your post.
    but how make it works to another browser like chrome ?? pls help me…

  28. Peter says:

    And what about Google Chrome? google-chrome-stable package

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

Subscribe without commenting

© 2005-2012 Ghacks.net. All Rights Reserved. Privacy Policy - About Us