I want to install Oracle's JRE and to update their lastest version through update-manager everytime they released. Is there a Ubuntu package that is provided by canonical or oracle?

Before release Java7, I followed this way to install Java6.

But it doesn't work for java7. There is no package sun-java7-xxx. How can you install java7?

link|improve this question

feedback

5 Answers

There is a similar question on how to install JDK 7

Install the JRE

Download the 32bit or 64bit Linux "compressed binary file" - it has a ".tar.gz" file extension and uncompress it

tar -xvf jre-7-linux-i586.tar.gz

JRE 7 package is extracted into ./jre1.7.0 directory. Now move the JRE 7 directory to /usr/lib

sudo mv ./jre1.7.0* /usr/lib/jvm/jre1.7.0

Afterwards run the following to get a list of currently installed java alternatives

sudo update-alternatives --config java

You will get output as:

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number:

Remember the last number and press enter to exit this utility i.e. in this example remember the number 2.

If only one alternative is shown then remember the number 0

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 3

This will add your new JRE 7 installation into alternatives list i.e. use the remembered number + 1 i.e. 3 in the example above. Now configure java to use the Oracle Java JRE

sudo update-alternatives --config java

You will see output similar one below - choose the number of jre1.7.0 i.e. 3:

There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/jre1.7.0/jre/bin/java 3 manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jre1.7.0/jre/bin/java to provide /usr/bin/java (java) in manual mode.

N.B. if there was no previous java installation then the new JRE will be the default and you will not see the above.

Check the version of you new JRE 7 installation:

java -version

Should produce

java version “1.7.0”
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode) 

Install the Firefox/Chrome plugin

In a terminal:

mkdir ~/.mozilla/plugins

Remove the IcedTea plugin, if it has been installed.

sudo apt-get remove icedtea6-plugin

Remove a former version of the Java plugin (may or may not be present)

rm ~/.mozilla/plugins/libnpjp2.so

Now you can install the plugin, by creating a symbolic link (you tell Firefox, where the plugin is located).

ln -s /usr/lib/jvm/jre1.7.0/lib/i386/libnpjp2.so ~/.mozilla/plugins/

Confirm that the JRE has been successful by using the official oracle website.

link|improve this answer
2  
After running sudo update-alternatives --config java, I get the following output:There is only one alternative in link group java: /usr/lib/jvm/java-6-openjdk/jre/bin/java Nothing to configure. What am I doing wrong? – Shoan Mar 18 at 4:56
1  
great answer, thanks! Wonder why Oracle can't spend the time to make packages for this.... – bbqchickenrobot Mar 26 at 22:11
1  
@Shoan, in that case, go to step "if only one alternative is shown then remember the number 0" – henrique Mar 27 at 1:57
What if I see Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) instead of Client? – Richard Apr 26 at 0:29
Thank you for this answer, Oracles instructions are rubbish for a linux noob, this made things alot easier! – David Barker May 9 at 9:33
feedback

On AMD64 you need modify a little the command to create the symbolic link:

ln -s /usr/lib/jvm/jre1.7.0/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

only change the i386 to amd64.

link|improve this answer
feedback

I propose one way to make easier the installation of Oracle's Java 7.

Since Ubuntu does not provides the Oracle's Java 7 packages, I'm providing a collection of Ubuntu packages on my own package repository.

The packages are fully integrated in the Ubuntu way to support Java. You will be able to select the Oracle's Java 7 alternative with the standard tools: update-alternative or update-java-alternative.

The main page of my contribution is: http://www.arakhne.org/jdk/index.html

To obtain the packages, you only need to add my package repository into your system configuration. The process is explained in http://www.arakhne.org/ubuntu.html

Stéphane.

link|improve this answer
2  
... just friendly advice - check oracle's redistribution license ... you dont want oracle's lawyers chasing you! – fossfreedom May 9 at 11:44
feedback

Missing update-alternatives of "javaws":

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.7.0/bin/javaws" 1

sudo update-alternatives --config javaws

link|improve this answer
feedback

Try this howto: https://sites.google.com/site/easylinuxtipsproject/java

link|improve this answer
5  
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. – Stefano Palazzo Aug 7 '11 at 10:55
feedback

Your Answer

 
or
required, but never shown

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