How to Install Java Runtime Environment (JRE) in Ubuntu
Sponsored Link
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.
Currently Ubuntu has the following Java packages
sun-java6-bin -- Contains the binaries
sun-java6-demo -- Contains demos and examples
sun-java6-doc -- Contains the documentation
sun-java6-fonts -- Contains the Lucida TrueType fonts from the JRE
sun-java6-jdk -- Contains the metapackage for the JDK
sun-java6-jre -- Contains the metapackage for the JRE
sun-java6-plugin -- Contains the plug-in for Mozilla-based browsers
sun-java6-source -- Contains source files for the JDK
Installing the Java Runtime Environment
First you need to check multiverse repository enabled or not after that open a terminal window. Since you are going to be installing the JRE and the web browser plug-in, you'll be using the following command from a terminal
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
Once it downloads the 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
You should get similar output
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Testing Java Plugin for Firefox
open Firefox and typing about:plugins in the address bar and check for java plugin
Hi ya’ll this site has been really useful. Feel I’m getting more understanding here then other Ubuntu forums dealing with Ubuntu 10.04 and Pogo.
I ran the commands lines like posters have said, made the necessary corrections.
And this is my version of java, when run the java -version command.
java version “1.6.0_18”
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)
AND
my firefox plugin for java
appears to still be using IceTea
Still new to Ubuntu, it may be different but I am liking it.
Matt’s answer worked for me as well, as I was getting error messages trying to use the console. Thanks!
Hi, I am VERY new to Ubuntu (first run). I have Ubuntu 10.04 and I tried the steps above, but when I typed these into the Terminal..It said:
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.
I have no idea what to do. Any help please?
sun-java6-plugin has been replaced by icedtea6-plugin.
So install icedtea6-plugin ‘sudo apt-get install icedtea6-plugin’
Installing java has a different name too:
openjdk-6-jre
OK, thanks alot.
I keep getting this problem…
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main tzdata 2010j-0ubuntu0.10.04
404 Not Found [IP: 91.189.88.31 80]
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main tzdata-java 2010j-0ubuntu0.10.04
404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2010j-0ubuntu0.10.04_all.deb 404 Not Found [IP: 91.189.88.31 80]
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata-java_2010j-0ubuntu0.10.04_all.deb 404 Not Found [IP: 91.189.88.31 80]
E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?
I cannot not find the tzdata-java_2010j-0ubuntu0.10.04_all.deb file anywhere… even in there tzdata archives…
Should I remove OpenJDK after installing JRE in ubuntu lucid? 😕
HEy Thanks for info. I am waiting for next ubuntu. currently using 10.04. @aryan OpenJDK dont need to remove. YOu can chose the sun jdk or jre from option.
I ran this in 10.04, and it ran correctly, however, when the screen about the operating distributor license comes up, I can’t get off it. The only button I can press that does anything is the down arrow, and once I’m to the bottom of the agreement, nothing happens. Does anybody have an idea of what happened?
I have same problem as Sundar: using a virtual machine Ubuntu 10.4 and it doesn’t find the packages mentioned in the article. An update might be in order 😉 ?
where can i download jre and jdk without it being from the ubuntu software center…
Hi
I also faced the same license page hanging issue for a long time in ubuntu 9.10. But was able to get over it by just pressing ‘Tab’ key. ‘Ok’ was made visible and clicking ‘Enter’ did the magic!
I know its a late reply but hope it helps 🙂
OMG!!! I love it when the code works! I also ran into the same problem with “Package sun-java6-jre is not available but is referred to by another package.” The post by oOze corrected my problem. Thanks to all who posted the code that worked for them. It seems to do the trick. I would suggest this as an update:
sudo apt-get install openjdk-6-jre-headless sun-java6-plugin sun-java6-fonts
I try to install these from .deb packages, but can’t do this because it has recursive dependences and I just add repository in sources.list, then update list in Synaptic, search needed packages by “sun-java6”, check for install sun-java6-jre, sun-java6-plugin and sun-java6-fonts – now all OK.
Thanks for guide
ubuntu10.4
Don’t forget the apt-get update after adding the new repository.
Good posting. I managed to get the plugin to work, but from what’s in this thread, I’ll go back and check to make sure that the rest of the packages installed correctly.
Regarding the plugin — remove the icedtea plugin and the Sun Java won will then appear — they can’t be there concurrently, even if you have disabled the icedtea. At least that’s how it worked for me…
RE Chuck Ishman
This command worked , it was slow d/l from wifi
sudo apt-get install openjdk-6-jre-headless sun-java6-plugin sun-java6-fonts
I’m at the point where I have to agree to the DLJ terms, and there is no yes for me to select. There is an OK at the bottom, except I can’t click on it. Can anyone help me with this.
@Chris: Try pressing the spacebar to select the “OK”, then press enter. I think that’s what I did…
@Chris and cSquall
press the TAB key to activate the then click enter
hw to check whether java is installed???
try to use the following command from terminal
java -version
How to enable Java in Mozilla 3.6.16 ?
I went through Edit-Preferences and i couldn’t find any thing related to ‘Java enable’
To install java on Ubuntu. Is very simple. Do this.
Type in the terminal windows this line
sudo apt-get install sun-java6-jre sun-java6-plugin
then hit y for “yes” and press enter and automatic start to install the java pluging
I don’t have a GUI on my Ubuntu server, but wanted a Minecraft server running. To install Java, I opened up a Screen and entered
sudo apt-get install sun-java6-jre
In the process, it popped up a “dialog” asking me to accept the license, but there was no way to respond to the dialog — probably due to the license being too many words to fit in the screen.
I opened up another Screen, and found the apt-get process, then followed it’s children until I found a whiptail process that was responsible for presenting the dialog. I killed that process.
The install then popped up another, smaller, dialog (something to the effect of ‘you must accept the license…’) that I COULD respond to, and the install succeeded after that.
It worked, Trojan, thanks!!
ps -fe | grep whiptail
kill #######
The above (sudo apt-get install sun-java6-jre) does not work for me:
# sudo apt-get install sun-java6-jre
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
OTOH, I would appreciate a hint on WHICH of the JRE’s (listed e.g. when you do “apt-cache search jre”) to install (differences) ?
The standard-jre would download 50MB, the gcj-jre only 20MB.
Hi,
I am using Xubuntu 10.10 and Google Chrome as browser. I installed the version 20 from Ubuntu Software Center, IcedTea, OpenJDK runtime and web start. It seems even today the version I got is still 20. However some companies in Singapore had upgraded their website and you need version 26. If the Ubuntu Software Center has not updated their Java package how can I upgrade to version 26?