I use Java only when I have to, and only ever the JRE (Java Runtime Environment) - there is no way I’ll use Java for development work. I’d rather eat my own ear wax to be honest!
Linux Mint 13 comes with OpenJDK installed, and a system I use which runs the fop
FO Processor, barfs with a Java.Lang.NullPointer Exception if OpenJDK is used.
The following is brief instructions on how to install Oracle’s java on Linux Mint.
Download Java JRE
Go to here and click on the “Free Java Download” button.
Click on Linux or Linux-x64 depending on whether you are running a 32 or a 64 bit Linux system. When prompted, select a suitable place to save the file, and click OK.
Remeber, you don’t want the various Linux*.rpm packages - they are for Red Hat/Fedora/Scientific Linux/Centos/OpenSuse/Oracle Linux distributions.
When the download is complete, you should have a saved copy of something like jre-7u10-linux-x64.tar.gz
Install Java
In a shell session (don’t be afraid!), change to the directory where you saved the downloaded file. In my case, that was Downloads/Java in my home directory. Then uncompress the file.
|
|
Lots of filenames will whizz past on the screen. Wait for the process to finish.
You now need to be root, so, use sudo sh
or su -
or whatever to get you into a root session. I use su
as my root user has been given a secure password.
In a root session, you need to move all the files you just extracted to the /usr/lib/jvm
|
|
That’s all done now, Java is in the correct place. All that remains is to configure the system to use it in preference to anything else that is present.
Still working as root, run the update-alternatives
command, as follows, to tell the system about the new Java version, and to set it as default.
|
|
And also the following:
|
|
That’s it, Oracle’s Java is now installed and will be used as the default.
If, for some strange reason, I had installed a full development kit, rather than just the runtime, I would have required the following two commands to be run as well - to configure the default java compiler and jar tool.
|
|
Changing the Default Java Version
The above makes my development tool happy as fop
no longer barfs with an exception and my FO source code is happily converted into pdf documents.
What happens when some other program doesn’t like to play with Oracle’s Java and needs the original OpenJDK version instead?
Simple, change the default again:
|
|
Press enter to keep the current choice[*], or type selection number:
The update-alternatives
displays all known installed versions of Java and lets you choose the one you want. The first entry is the current one, and you simply type in the number of the one you want instead.
Have fun. (If there’s such a thing as fun where Java is involved!)