Installing Oracle Java 7 on Linux Mint 13

   Send article as PDF   

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.

$ cd ~/Downloads/Java
$ tar -xvzf jre-7u10-linux-x64.tar.gz

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

$ su -

$ cd ~norman/Downloads/Java
$ ls
jre1.7.0_10  jre-7u10-linux-x64.tar.gz

$ mv jre1.7.0_10 /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.

$ update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_10/bin/java 1065

update-alternatives: using /usr/lib/jvm/jre1.7.0_10/bin/java to provide /usr/bin/java (java) in auto mode.

And also the following:

$ update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jre1.7.0_10/bin/javaws 1065

update-alternatives: using /usr/lib/jvm/jre1.7.0_10/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.

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.

$ update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jre1.7.0_10/bin/javac 1065
$ update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jre1.7.0_10/bin/jar 1065

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:

update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
* 0            /usr/lib/jvm/jre1.7.0_10/bin/java                1065      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode
  3            /usr/lib/jvm/jre1.7.0_10/bin/java                1065      manual mode

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!) 😀

7 thoughts on “Installing Oracle Java 7 on Linux Mint 13”

  1. My most recent attempt to get Java working was so that I could load a custom ROM onto an HP Touchpad and the first requirement is that Java must be installed. I thought it was already installed but disabled as of a couple of months back, but I guess I must have wiped it out. Anyway I’ve been finding trace of java all over my machine (Linux Mint 13, Lenovo X60) and no amount of uninstalls, installes, configs, etc. has got me working. Your tutorial is my most recent attempt but leaves me scratching my head when I go to the Java site to test whether I’ve got a working Java.
    “java -version” and “sudo update-alternatives –config java” give me this output

    kenneth@kenneth-ThinkPad-X60 ~ $ sudo update-alternatives –config java
    [sudo] password for kenneth:
    There is 1 choice for the alternative java (providing /usr/bin/java).

    Selection Path Priority Status
    0 /usr/lib/jvm/jre1.7.0_21/bin/java 1065 auto mode
    * 1 /usr/lib/jvm/jre1.7.0_21/bin/java 1065 manual mode

    Press enter to keep the current choice[*], or type selection number: 0
    kenneth@kenneth-ThinkPad-X60 ~ $ java -version
    java version “1.7.0_21”
    Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
    Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)

    Different tutorials show Java installed in various locations. I’ve even tried a synaptic install but still get nowhere.

    Any ideas where I’m going wrong?


  2. Hi Krusty,

    it appears from the above that you have got the JRE installed as opposed to the JDK. The former being the Java Runtime Environment – good for running Java programs etc, the latter is the Java Development Kit which you would use to develop Java applications.

    My blog posting above, hopefully, does mention what yo need to do if you need the JDK installing and configuring. I don’t mention that you get the full JDK at this address

    Good luck.

    By the way, can you update your profile here so that you have a proper name to go with your username please> I get lots of spam-bots registering and I usually remove them be simply deleting all the registered users without a proper name. Thanks.


    1. Will do re: my profile.

      My goal was to get the Runtime Environment working so I could install a special HP installer called Palm Novacom installer.
      It’s a .jar file (See pt. #2 at this link
      I was able to complete the install of Android onto my Touchpad using a Windows 7 machine that I had just finished repairing for my boss but I’d still like to get Java Runtime running on my Linux laptop. I don’t believe I need the full JDK as the instructions cited above send me to the same Java download site mentioned at the top of your blog/rant. That’s where I originally downloaded jr1.7.9_21 in a tarball.

  3. In re: the final steps
    And also the following I wonder if my problem lies here somewhere??? I looked via Nautilus at /usr/bin and found nothing called “javaws”…only “java” However, javaws does appear in the second location /usr/lib/jvm/jre1.7.0_21

    $ update-alternatives –install /usr/bin/javaws javaws /usr/lib/jvm/jre1.7.0_10/bin/javaws 1065

    update-alternatives: using /usr/lib/jvm/jre1.7.0_10/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.

    Here’s the result of the above commands
    kenneth@kenneth-ThinkPad-X60 ~ $ update-alternatives –install /usr/bin/javaws javaws /usr/lib/jvm/jre1.7.0_21/bin/javaws 1065
    update-alternatives: using /usr/lib/jvm/jre1.7.0_21/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.
    update-alternatives: error: error creating symbolic link `/etc/alternatives/javaws.dpkg-tmp’: Permission denied
    kenneth@kenneth-ThinkPad-X60 ~ $ update-alternatives: using /usr/lib/jvm/jre1.7.0_21/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
    bash: syntax error near unexpected token `(‘

    krusty (Kenneth Browne)

  4. I think I just solved the problem. The instructions say to go to the firefox plugins directory and from there use the ln -s command to creat a new symbolic link. However when I reader this
    “To remove old symbolic link:
    type cd /plugins
    I took it to mean there was a file by that name so “rm” resulted in a no such file.
    Instead I typed rm and then reran the ln -s command. About:Plugins now shows my Java install and
    When I ran the test Java applet I got an “out of date” warning, but when I clicked the “run anyway” message I got

    Verified Java Version

    You have the recommended Java installed (Version 7 Update 21).

    Now I have to see if I can install that Novacom installer from HP!

  5. Morning Krusty,

    glad to hear you got it working. I think, in an earlier comment, the reason for update alternatives barfing with permission denied errors is the need for you to either use sudo, or to already have ‘su -‘ to root.

    I’m definitely not a Java guru, I actually hate the language, but I do need it for some stuff I use – creating documentation for example, and as my fop processor doesn’t like openjdk, I have to use the Oracle java runtimes to get it working.


    1. I am guessing that the old link made reference to a previous version from an old installation and so when I deleted the old version ad created a new link everything was OK. I don’t think I need it working now as I can add new ROM’s by copying them to the internal /sdcard and rebooting into clockwork recovery.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.