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".
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
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
And what about Google Chrome? google-chrome-stable package
its done, so easy. thank you for your post.
but how make it works to another browser like chrome ?? pls help me…
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!
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!!
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…
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…
Very good article. Clear and easy to follow.
Thanks a lot!
Thanks for the post. It’s totally do-able ;)
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.
Thank you. I appreciate the help.
Please write me back if you would like to learn about UFirstFinancial.com
Russel
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:~$
http://www.ubuntugeek.com/how-install-sun-java-runtime-environment-jre-in-ubuntu-10-04-lucid-lynx.html
Here you go!
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 . .. . ..
pls refer me to download jdk and jre (java package) on ubuntu 10.04…. i dont know how to download and install java package ….
Wow!! Just amazing and simple steps, Just what I need, thnx!!!!!!!1
Magic. Thank you. Clear concise instructions. Now I have my PC back. :-)
Thank you so much! I spent days before, trying to install this java plugin, now it works! :)
Ubuntu 10.04, Chromium
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.
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.
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!!!!!
Probably you are not updating the apt sources
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)
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
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
Thanx it was usefull.
“I hope this has helped make that “do†a little more “ableâ€.”
Oh yes, the instructions are lucid and specific.
Thanks.
This topic was very useful, I wonder if you could tell how to install adobe flash player in Ubuntu 10.04 64 bit.
Thanks
sudo apt-get install ubuntu-restricted-extras
Could also maybe give this a shot:
http://mattrudge.wordpress.com/2010/05/07/installing-flash-player-from-repository-on-ubuntu-10-04-64-bit/
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.
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.