Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I am going to download & install java on Ubuntu 12.04 LTS (32-bit system)

On java download page, there are 2 download options.

  1. Java for Linux Platforms
  2. Java for RPM based Linux Platforms

Which would be better suited for Ubuntu?

share|improve this question

marked as duplicate by Braiam, Luis Alvarado Oct 4 '13 at 2:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

RPM is Redhat, Fedore, CentOS so unusable.

You need, preferably, a DEB version or otherwise the tar.gz version.

I would advicw to use a personal archive as explained here:http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html

Install method for java 7:

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit

You can then install this...

sudo apt-get install oracle-java7-set-default

"To automatically set up the Java 7 environment variables"

share|improve this answer
    
Thanks. But I wish to get an installer package for offline installing, instead of every time downloading from the web. –  Vineet Jul 28 '13 at 5:36
    
@Vineet I wouldn't do that since Java has several release/year (if not months) to fix security vulnerabilities. If you have internet access where you need Java, the best option is using the repositories. –  Braiam Oct 3 '13 at 14:07

Use the Java for Linux Platforms. Here are the download instructions 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). For 32bit java use

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

For 64bit java use

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

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

SOURCE: How can I install Sun/Oracle's proprietary Java 6/7 JRE or JDK?

share|improve this answer
    
Awesome comment about update-alternatives. This answer deserves way more points than it has. –  spaceknarf Jun 30 at 8:59
    
If you want to install a JDK, take note of askubuntu.com/questions/315646/… –  spaceknarf Jun 30 at 9:25

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