Install Java on Ubuntu 10.04 - gHacks Tech 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".


Advertisement

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:


Previous Post: «
Next Post: »

Comments

  1. J Moore said on May 22, 2010 at 3:01 am
    Reply

    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 said on May 22, 2010 at 3:52 am
    Reply

    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 said on May 22, 2010 at 5:37 am
    Reply

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

    Thanks

    1. Shon said on May 22, 2010 at 6:55 am
      Reply

      sudo apt-get install ubuntu-restricted-extras

  4. Indian-Art said on May 22, 2010 at 7:10 am
    Reply

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

    Oh yes, the instructions are lucid and specific.

    Thanks.

  5. hasintha said on May 22, 2010 at 3:15 pm
    Reply

    Thanx it was usefull.

  6. jasray said on May 22, 2010 at 7:22 pm
    Reply

    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 said on May 25, 2010 at 4:48 pm
    Reply

    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 said on May 25, 2010 at 10:11 pm
    Reply

    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 said on May 26, 2010 at 3:25 pm
    Reply

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

    1. eniwetok said on July 26, 2010 at 9:53 pm
      Reply

      Probably you are not updating the apt sources

  10. jasray said on May 26, 2010 at 6:48 pm
    Reply

    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 said on May 29, 2010 at 12:44 am
    Reply

    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 said on June 1, 2010 at 10:28 pm
    Reply

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

  13. David Roberts said on June 30, 2010 at 9:42 pm
    Reply

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

  14. The silence said on July 1, 2010 at 8:36 pm
    Reply

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

  15. jeyamuthuramalingam said on August 16, 2010 at 7:48 am
    Reply

    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. jeyamuthuramalingam said on August 16, 2010 at 7:54 am
    Reply

    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. Gustavo said on August 23, 2010 at 6:55 am
    Reply

    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:~$

  18. Russel said on August 24, 2010 at 8:09 pm
    Reply

    Thank you. I appreciate the help.

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

    Russel

  19. Russel said on August 24, 2010 at 8:13 pm
    Reply

    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.

  20. Yanis said on October 12, 2010 at 9:30 am
    Reply

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

  21. Nathan said on November 6, 2010 at 1:55 am
    Reply

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

  22. kishor said on November 12, 2010 at 9:47 am
    Reply

    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…

  23. Stanley Bob-Carl Ozoemena said on December 26, 2010 at 1:25 am
    Reply

    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…

  24. Stanley Bob-Carl Ozoemena said on December 27, 2010 at 3:07 am
    Reply

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

  25. Stanley Bob-Carl Ozoemena said on December 28, 2010 at 12:07 pm
    Reply

    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!

  26. write said on May 13, 2011 at 4:34 am
    Reply

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

  27. Peter said on November 11, 2011 at 10:56 am
    Reply

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

  28. shane said on May 8, 2012 at 2:46 am
    Reply

    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

    what is this and how do i get it to work right

  29. RR said on December 8, 2012 at 10:36 pm
    Reply

    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

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.