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:
sudo mkdir java
I was also experimenting with the 32 and 64 bit versions, so made two extra directories within java:
sudo mkdir 32 64
I then moved the relevant file(s) to the respective directories, and made them executable:
sudo mv ~/Desktop/jre-6u15-linux-i586.bin /opt/java/32
sudo chmod 755 /opt/java/32/jre-6u15-linux-i586.bin
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:
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:
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
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'.
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:
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:
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:
The Plugin can now beÂ installed by either copying the file:
cp /opt/java/32/jre1.6.0_15/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/
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)
ln -s /opt/java/32/jre1.6.0_15/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/
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