Installing JDK 7 on Linux Mint / Ubuntu 12.10 “Quantal Quetzal” (64 bit)

For some years now, the following procedure is my favorite way for installing java on Ubuntu.

The following pages were my sources for installing Java

http://www.shinephp.com/install-jdk-7-on-ubuntu/

http://wiki.ubuntuusers.de/Java/Installation/Manuell

Download java

http://www.oracle.com/technetwork/java/javase/downloads

First extract the .tar.gz-file

Second move it to the correct directory

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

It makes sense to add a symlink:

sudo ln -s /usr/lib/jvm/jdk1.7.0_09 /usr/lib/jvm/java-7-sun

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 2

Selection    Path                                   Priority   Status
 ------------------------------------------------------------
 * 0            /usr/lib/jvm/java-6-sun/bin/java    63        auto mode
 1            /usr/lib/jvm/java-6-sun/bin/java    63        manual mode
 2            /usr/lib/jvm/java-7-sun/bin/java    1         manual mode

sudo update-alternatives --config java
java -version

When updating java, you just make an new java-7-sun – symlink to the new jdk-dir and it’s done.

There is also the compiler to install …:

sudo update-alternatives --config javac
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-sun/bin/javac 1
javac -version

… and Webstart:

sudo update-alternatives --config javaws
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/java-7-sun/bin/javaws 1

Close Firefox

sudo update-alternatives --install /usr/lib/mozilla/plugins/mozilla-javaplugin.so mozilla-javaplugin.so /usr/lib/jvm/java-7-sun/jre/lib/amd64/libnpjp2.so 1
sudo update-alternatives --config mozilla-javaplugin.so

Source: http://brunoreis.com/tech/intalling-java-ubuntu-natty/

sudo update-alternatives --config java

Updating of Java

Nowadays you have to update java quite often. A simple procedure is to copy the new java Version to /usr/lib/jvm and to update the symlink.

Download and extract the jdk-7uXX-linux-x64.tar.gz – File

tar -vxzf Downloads/jdk-7u17-linux-x64.tar.gz

Move the new jkd-directory to /usr/jvm/lib


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

Update the symlink

sudo ln -nsf /usr/lib/jvm/jdk1.7.0_17 /usr/lib/jvm/java-7-sun

Test the correct java – version

java -version

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)

Restart Firefox
Delete the old jdk-directory

sudo rm -r /usr/lib/jvm/jdk1.7.0_13
This entry was posted in Linux. Bookmark the permalink.

12 Responses to Installing JDK 7 on Linux Mint / Ubuntu 12.10 “Quantal Quetzal” (64 bit)

  1. Pamp says:

    Many thanks !

  2. Shokodemon says:

    quick and painless.

    virtual hug.

  3. Rahat Ahmed says:

    Worked perfectly, thanks!

  4. venky says:

    Does this procedure automatically sets JAVA_HOME path?

  5. aswini says:

    how to set the class path for my programs ??????

  6. grove says:

    Awesome, finally some instructions that work!

  7. P_W999 says:

    Awesome, exactly what I was looking for 🙂
    Just one remark: you first have to ‘–install’ before you do the ‘–config’ 😉

  8. Jovanny says:

    Thanks a lot 🙂

  9. Nick says:

    A million thanks! Worked like a charm in mint 15 (aside from having to sub in current jdk version, which was just plane easy).

Leave a comment