Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I install Java and also in my browser so websites with Java work?

share|improve this question
1  
It's how to install on an old OS. :P – Marcos Roriz Jan 29 '12 at 17:36
While 10.04 LTS is an older OS, it's the current LTS and the preferred one on a server install as it'll be supported. – tommy chheng Feb 4 '12 at 3:11
sudo apt-get install icedtea-plugin – IgnitE Mar 2 at 14:15
Is this an answer ? – Septrba Mar 2 at 14:32
Yes, there is icedtea-plugin for firefox. This has been answered in some other questions too, so I just added a comment here. – IgnitE Mar 2 at 21:48
show 1 more comment

12 Answers

up vote 28 down vote accepted

Installing OpenJDK is not enough for enabling Java in browsers. You'll also need to install the icedtea6-plugin package:

Install via the software center

A restart of the browser might be required.

share|improve this answer

There are several implementations of Java, the 3 most common implementations when talking about it for Ubuntu are:

  • OpenJDK: The primary goal of the OpenJDK project is to produce an open-source implementation of the Java SE Platform (6 and 7). This is the default version of Java that Ubuntu uses and is the easiest to install.
  • Sun Java: Sun Java is the reference implementation for Java 6. It's support has been discontinued in Ubuntu.
  • Oracle Java: Oracle Java is the OpenJDK Java Se Platform version 7 implementation from Oracle. Oracle introduced with this implementation a license that prevents distribution.

Since Ubuntu 11.10 and due to license issues Ubuntu will no longer distribute Oracle's JDK and JRE. Also previous versions supplied on PPAs suffer from security issues are are not recommended to be installed on any Ubuntu system.

There are no more supported .deb releases from Ubuntu with reference to Sun Java or Oracle Java, Ubuntu officially supports OpenJDK and OpenJRE implementation of Java which is the base for Oracle's own implementation.

OpenJRE is the official implementation of Java Runtime Environment for your Ubuntu systems and should suffice to run any Java program that you might require and its included in the main repo and its easily installable.

OpenJRE

Install via the software center

Or by opening a terminal and typing

sudo apt-get install openjdk-7-jre

The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package:

Install via the software center


Also important is to install the wrapper for supporting Java applications on your web browser Iced-Tea Java Plugin.

IcedTea Plugin

Install via the software center

or via a terminal

sudo apt-get install icedtea-plugin

Or look for icedtea-plugin in the Ubuntu Software Center


To make sure that you are running the correct version of Java use this command to set your choice

sudo update-alternatives --config java

java -version should display the choice you previously made.


If you need to install OpenJDK-JRE6 or OpenJDK-JDK6

openjdk-6-jre (click to install) is available for installation for Ubuntu 8.04 and up.

Install it with

sudo apt-get install openjdk-6-jre

Or if you need the developers package openjdk-6-jdk (click to install) install it with

sudo apt-get install openjdk-6-jdk

A version of the icedtea-plugin (click to install) is also available to install if you are going to use OpenJDK6.

Install it with

sudo apt-get install icedtea6-plugin

If you really want to use Oracle's Java Se Platform

share|improve this answer

For installing Oracle Java 7:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo mkdir -p /usr/lib/mozilla/plugins #just in case, this will be added to the package in the next version
sudo apt-get install oracle-jdk7-installer
share|improve this answer

Installing OpenJDK - Recommended

The simplest way to install Java on Ubuntu is to use OpenJDK. This will work fine for most people. To install it, click on the small button with the Ubuntu logo on it, as shown in the screenshot below.

enter image description here

After opening the Dash Home, you need to type in Terminal. Click on the icon that is circled in the screenshot below.

enter image description here

This will open the Terminal, which is Ubuntu's version the the Windows Command prompt, though the Terminal has many more features. Now, copy and paste the following command into the Terminal window. You will need to use ControlShiftV to paste text into the terminal.

sudo apt-get install -y openjdk-7-jre openjdk-7-jdk

You will need to enter your password to use this command. Although it will not show up in the Terminal, it will still be entered when you type it. After running this command, you will be set up to run and develop Java applications.

Installing Oracle Java

OpenJDK works fine for most people, but if you play Minecraft, you will want to use Oracle Java instead. To install Oracle Java, run the command below one at a time in the Terminal.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

This will download Java from Oracle's website, and install it for you.

share|improve this answer
1  
-1 for 3 major reasons: 1 - JDK and JRE alone are not enough to enable java in Web Browsers. You still need icedtea-plugin package (icedtea6-plugin or icedtea7-plugin, the one that matches your java); 2 - JDK already includes the JRE, so no need to install both. Choose either JRE for regular users (like the OP) or JDK for java developers. 3 - Since you had the trouble to post nice screenshots, why suggest the terminal route? Software Center is much more friendly and recommended in this case – MestreLion Mar 19 at 2:28

Open your terminal with Ctrl+Alt+T and:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
share|improve this answer
Thanks a lot... but i tried the last sentence "sudo update-alternatives --config java" says "There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-7-oracle/jre/bin/java Nothing to configure." How this is supposed to check if it is in use ??? – Septrba Mar 2 at 14:35
@Septrba You have only "one" Java version installed, only one can be in use, and it's the one you have installed. If you had more than one installed, it would list and show which one is in use. Probably shouldn't have added that to my answer, since it was probably more confusing than helpful. :P – pileofrocks Mar 4 at 20:39

Unfortunately, because of issues with its license, Oracle Java is no longer distributed within the official Ubuntu repositories. You have two main options: either try OpenJDK -- an open source replacement for Oracle Java -- or proceed with the "manual" installation (which is exactly what you were trying to do). Both these options are described on the help wiki: https://help.ubuntu.com/community/Java. This page also include some other alternatives that, depending on your needs, you may find more suitable.

Just a side note: most of the time, with Ubuntu, you should not download software from the Internet, but rather use the Ubuntu Software Center. The software you'll find there is ensured to be stable, safe and to respect the standard conventions of the system. Oracle Java is just an exception to this rule.

share|improve this answer

Just go to Aplications --> Ubuntu software center and then search for Java. enter image description here

share|improve this answer
Your answer would be that the OP installs the previous Java Runtime Environment, and not the latest version jre-6u25-linux-i586.bin – scouser73 Jun 13 '11 at 14:33
Scouser73, jre-6u25-linux-i586.bin sounds like the proprietary Java implementation from Oracle. This question is about OpenJDK. – Lekensteyn Jun 13 '11 at 19:01
The one that is marked (in orange) is the open-jdk java6 runtime! – Alvar Jun 13 '11 at 19:27
scouser73 is referring to a security update of Oracle Java. I don't know if the current version if affected, the installed JRE version is 6b22 but bear in mind that this is unrelated to the version number of Oracle Java, see dbhole.wordpress.com/2011/05/27/… – Lekensteyn Jun 13 '11 at 19:33
well, Scouser73 had problems with a we page. I only use the jdk and that is all I ever need so I thought it would help. – Alvar Jun 13 '11 at 20:38

While I haven't found a good repo for openjdk7, i found an up to date repo for oracle jdk 7 http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

Would be nice to see one for openjdk7

share|improve this answer

There are a few ways to install Java in Ubuntu:

Install OpenJDK (The open source equivalent to Sun's Java) directly from Ubuntu Software Center. All you need to do is search for Java. That tends to work as is for me.

If you need Sun's Java, say if you want to play Minecraft, you download the JRE as you described from Java.com, but make sure your .bin-file can be executed. You do that by opening a terminal and typing the following (I will assume you have it in your Downloads folder so change the cd line accordingly if that's not where it is):

cd /home/user/Downloads
sudo chmod +x jre-6u31-linux-i586.bin

Then, you should be able to close your terminal, right click on your .bin-file and select "Execute", which should run the installer. If this is not an option, just do the following from terminal (in the same folder as the two other actions):

./jre-6u31-linux-i586.bin

That simply runs the specified file and if you successfully typed in the two first lines, the installation.

share|improve this answer

Wow! I had problems with this for a few days - and, even though i do like FLOSS/FOSS philosophy, there are just some things that run better. Java being an example (we'll leave out my other issue with Proprietary software/drivers LOL)

I stumbled upon this today - thankfully - when i was in doubt as to if i should install open source, or Sun's java. And, i found this guide (VERY helpful, and just go to the link below in the description of the video!)

This guy is very knowledgeable, and i had it installed in less than 5 minutes!

I do have to say, that this is my 3rd time installing ubuntu, cause, i went back to 11.04 today, and did a dual boot - half of my TB drive to windows, the other to ubuntu xD = VERY HAPPY! lol.

http://www.youtube.com/watch?v=aG7HAjwTChg

share|improve this answer
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Peachy Sep 27 '12 at 22:27

There's an OpenJDK PPA and it seems they have packages for the 10.04 version: OpenJDK PPA

share|improve this answer
I did sudo add-apt-repository ppa:openjdk/ppa; sudo apt-get update; and get W: Failed to fetch ppa.launchpad.net/dlecan/openjdk/ubuntu/dists/lucid/main/… 404 Not Found – tommy chheng Jan 17 '12 at 21:18
Also, looks like their openjdk-7 is from a year ago? openjdk-7 7~b117~pre1-0lucid1 Matthias Klose (2010-12-12) – tommy chheng Jan 17 '12 at 21:22
It's true. I'm sorry. I should have read a bit more about it before posting an answer. – lafdez Jan 17 '12 at 21:49

I'm not sure if there is a way to install by package but there is a way to install manually. Here is a very detailed (and perhaps easy) step-by-step on how to do it.

share|improve this answer
anyone care to explain the downvote? – Marcos Roriz Jan 29 '12 at 17:42
1  
Probably because just posting links to blog posts is not welcome because of possible link rots in the future. It is preferable to quote necessary parts here. And also, the blog post seems to suggest that the method is only for 11.04 and not 10.04. – jokerdino Jan 29 '12 at 17:56
ok :), should I delete my answer? – Marcos Roriz Feb 4 '12 at 3:47
1  
Since an answer has been found, if I were you, I would delete it. Saves from more downvotes. :) – jokerdino Feb 4 '12 at 5:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.