Since Oracle Java can no longer be available in the various Linux distributions, for licensing reasons, a number of more or less complicated guides have been written about how to install Oracle Java manually. This is another such guide, but less ambitious and hopefully easier to understand and use. It only describes how to install the JRE (the Java Runtime Environment), integrate it with Firefox and create a shortcut to the Java Control Panel.
It is divided into two parts, the first part is about installing and setting up symbolic links and shortcuts, the second is about upgrading to a new version.
Part 1 - First installation
Before we start, this is what we are going to achieve:
- The JRE will be installed in /opt/java. This directory will contain the full JRE as well as a symbolic link to the current version.
- A symbolic link to libnpjp2.so in .mozilla/plugins in your home directory. This provides the Firefox plugin integration.
- Association of jnlp files to Java Web Start.
- A shortcut to the Java Control Panel.
In the examples below, we will install the 64 bit JRE 1.7.0_17. If you are installing another version you will have to use the relevant version number where applicable.
Step 1 - Download and install Java
Download the latest version from here: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Choose a file suitable for your architecture, e g jre-7u17-linux-x64.tar.gz.
Unpack the file by performing the following commands in a Terminal window:
sudo mkdir /opt/java
sudo tar xf /path-to-your-download-directory/jre-7u17-linux-x64.tar.gz
sudo ln -nfs jre1.7.0_17 jre
These commands will unpack the JRE into /opt/java and create a symbolic link, /opt/java/jre, to the latest version.
Step 2 - Install the Firefox plugin
Installing the firefox plugin is simple. Just create a symbolic link to libnpjp2.so in your personal .mozilla/plugins directory:
mkdir plugins (may fail if it already exists)
ln -nfs /opt/java/jre/lib/amd64/libnpjp2.so
Restart Firefox and check Tools/Add-ons/Plugins to make sure that Java Plugin is listed.
Step 3 - Associate jnlp files with Java Web Start
In Firefox, open Edit/Preferences, switch to the Applications tab and search for jnlp. If you have an association already you can edit it here, otherwise Firefox will prompt you the next time you attempt to access a jnlp file. In either case you should tell Firefox to use /opt/java/jre/bin/javaws.
Step 4 - Create a shortcut to the Java Control Panel.
How to do this depends on which desktop environment you use. For KDE you right click the Application Launcher and choose Edit Applications. Then create a new entry in the menu of your choice, called Java Control Panel. The command should be /opt/java/jre/bin/jcontrol and the icon should be /opt/java/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png.
Done! You should now have a working JRE installation that is integrated with Firefox.
Part 2 - Upgrading
Upgrading to a new version is easy thanks to the symbolic link we created in Step 1. Just download the new version and repeat this step, substituting the new version number for jre1.7.0_17.
The last command, sudo ln -nfs jreversion jre, will change the jre link to point to new version. Since all other references to the JRE installation goes through this link, that is the only change needed to switch to the new version.
Add new comment