2 Synthesis‎ > ‎Computing‎ > ‎Programming‎ > ‎Java‎ > ‎


Install the JDK

First un-install any previous versions!

You can download the "JDK" and "Demos and Samples" from here;

Oracle: Downloads

It directs you to a sub-page where you can choose Linux x64 ".gz" files for the "JDK" and "Demos and Samples". In my case these were;


The process below was based on How do I install Oracle Java JDK 7? but needed some changes but it wasn't obvious so try this remembering to change the version number if you downloaded a later version than me.

The bold type is what I typed, the light type is the computer. The prompt I have omitted in most places but not all so don't type it in with the rest;

Now starting in your home folder type;

cd Downloads

So now the current directory is the "Downloads" directory and that's where we will work. Type so as to decompress the files.

tar -xvf jdk-7u17-linux-x64.tar.gz
tar -xvf jdk-7u17-linux-x64-demos.tar.gz

Both folders decompress into the same folder in Downloads which then has to be moved to /usr/lib with;

sudo mv ./jdk1.7.0_17 /usr/lib/jvm/jdk1.7.0

Now type;

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

I assume this chooses some extra bits. I don't know what they do. Type;

sudo update-alternatives --config java

You will see output similar one below - choose the number of jdk1.7.0 - for example 2 in this list:

There are 2 choices for the alternative javaws (providing /usr/bin/javaws).

  Selection    Path                                        Priority   Status
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/javaws   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/javaws   1061      manual mode
  2            /usr/lib/jvm/jdk1.7.0/bin/javaws             1         manual mode

Press enter to keep the current choice[*], or type selection number:

Type 2 or what ever is the appropriate choice sorry I can't advise better then that! The computer responds;

update-alternatives: using /usr/lib/jvm/jdk1.7.0/bin/javaws to provide /usr/bin/javaws (javaws) in manual mode.

Repeat the above with the following but bare in mind the response might not be 2:

sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Now check the version of you new JDK 7 installation;

java -version

The computer responds with something like;

java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Enable mozilla firefox plugin by putting a link to it into firefoxes plugins directory. Type;

ln -s  /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so  /usr/lib/firefox-addons/plugins

There is a file  /etc/apparmor.d/abstractions/ubuntu-browsers.d/java which should contain some lines that can be commented out like so;

# Replaced the lines
#  /usr/lib/jvm/java-6-openjdk/jre/lib/*/IcedTeaPlugin.so mr,
#  /usr/lib/jvm/java-6-openjdk/jre/bin/java cx -> browser_openjdk,
#  /usr/lib/jvm/java-*-sun-1.*/jre/bin/java{,_vm} cx -> browser_java,
#  /usr/lib/jvm/java-*-sun-1.*/jre/lib/*/libnp*.so cx -> browser_java,
# with
  /usr/lib/jvm/jdk*/jre/bin/java{,_vm} cx -> browser_java,
  /usr/lib/jvm/jdk*/jre/lib/*/libnp*.so cx -> browser_java,
# Tom de Havas 11/3/13

The easy way to do this is to take a copy and save it in the current directory which will still be "Downloads" then move it to the destination with an sudo. Type;

sudo mv java /etc/apparmor.d/abstractions/ubuntu-browsers.d/java

and then type;

sudo /etc/init.d/apparmor restart

You should some text followed by [OK]. I don't know what this does other than restart something.

Then finally follow this link to test it. You may need to restart Firefox before you do;

Hopefully it worked because I don't have any other suggestions!


As far as I can see Firefox finds plugins in these locations;


On my computer these as both links to;


Which contains a short cut to;