Installing JRE

First, decide on which architecture will be installed, and download the relevant file from the main Java website – if you’re running a 64 Bit Linux OS, download the 64 Bit JRE.

At the time of writing, 1.6.0 u15 can be downloaded from the following: 32 bit JRE, and 64 bit JRE. I wanted to install the x64 version, and so downloaded jre-6u15-linux-x64.bin to my Desktop. I also wanted to install it in its own directory in /opt, and so created a directory for it to sit in:

cd /opt
sudo mkdir java

I was also experimenting with the 32 and 64 bit versions, so made two extra directories within java:

cd java
sudo mkdir 32 64

I then moved the relevant file(s) to the respective directories, and made them executable:

32 bit:

sudo mv ~/Desktop/jre-6u15-linux-i586.bin /opt/java/32
sudo chmod 755 /opt/java/32/jre-6u15-linux-i586.bin

64 bit:

sudo mv ~/Desktop/jre-6u15-linux-x64.bin /opt/java/64
sudo chmod 755 /opt/java/64/jre-6u15-linux-x64.bin

The final part of the installation simply involves executing the binary file:

32 bit:

cd /opt/java/32
sudo ./jre-6u15-linux-i586.bin

64 bit:

cd /opt/java/64
sudo ./jre-6u15-linux-x64.bin

Regardless of architecture, this should create a sub directory called jre1.6.0_15.

Setting JRE 1.6.0 u15 as Default

The process simply involves telling the system that there is an alternative Java binary available, and to use this binary to execute an “java” commands:

32 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/32/jre1.6.0_15/bin/java" 1
sudo update-alternatives --set java /opt/java/32/jre1.6.0_15/bin/java

64 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.6.0_15/bin/java" 1
sudo update-alternatives --set java /opt/java/64/jre1.6.0_15/bin/java

Follwing the second command, there should be output to the terminal something along the lines of:

Using '/opt/java/32/jre1.6.0_15/bin/java' to provide 'java'.

or,

Using '/opt/java/64/jre1.6.0_15/bin/java' to provide 'java'.

depending on the architecture installed.

To double check everything is as it should be, in a Terminal run:

java -version

This should output something along the lines of:

java version "1.6.0_xx"
Java(TM) SE Runtime Environment (build 1.6.0_xx)
Java HotSpot(TM) 64-Bit Server VM (build xxxx, mixed mode)

That’s it. Now every time “java” is run, either explicitly from the Terminal, or via a Java executable (such as theEclipse IDE), the newly installed /opt/java/64/jre1.6.0_15/bin/java binary will be used as opposed to the binary installed by default. Simple, eh?

Installing the Browser Plugin

Note: For the 64 bit plugin, it is strongly recommended that you use the version of Firefox available for installation via your distribution’s repositories.

As with most Firefox plugins, they can be installed in ~/.mozilla/plugins – if it doesn’t exist, it can be created:

mkdir ~/.mozilla/plugins

It may also be necessary to uninstall any previous Java installations, such as IcedTea etc.:

sudo apt-get remove icedtea-gcjwebplugin

Note: if you’re upgrading from a previous JRE install, remove the old plugin first:

32 Bit:

rm ~/.mozilla/plugins/libjavaplugin_oji.so

64 Bit:

rm ~/.mozilla/plugins/libnpjp2.so

The Plugin can now be installed by either copying the file:

32 Bit:

cp /opt/java/32/jre1.6.0_15/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/

64 Bit:

cp /opt/java/64/jre1.6.0_15/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

or by creating a symbolic link to the file (this is the best option)

32 Bit:

ln -s /opt/java/32/jre1.6.0_15/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/

64 Bit:

ln -s /opt/java/64/jre1.6.0_15/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Once installed, restart Firefox. There are two methods to see if the Plugin is installed – navigate to about:plugins

Source: http://www.unix-tutorials.com

Post By Editor (2,827 Posts)

Website: →

Connect