Install Oracle Java JDK on Debian

Get the source file from Oracle.Since I used JDK 7, I visited this page and downloaded jdk-7u10-linux-i586.tar.gz (for Linux x86).

Extract it somewhere

curl -J -O -C -
mv jdk-7u10-linux-i586.tar.gz?AuthParam=1355492655_c33bc95a6d13e7345ba318a0b46bcc4a jdk-7u10-linux-i586.tar.gz
tar -xvvf jdk-7u10-linux-i586.tar.gz

Perform the installation:

sudo mv ./jdk1.7.0_10 /usr/lib/jvm/jdk1.7.0
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

Now choose the correct version of the programs if you have more than installed (as is most likely the case as the OS often comes with a version, and you install another). This is to avoid the error message that states that the version of java and javac clash (or something similiar).

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


[[email protected] droidzone]# sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                            Priority   Status
  0            /usr/bin/gij-4.4                 1044      auto mode
  1            /usr/bin/gij-4.4                 1044      manual mode
* 2            /usr/lib/jvm/jdk1.7.0/bin/java   1         manual mode

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

As noted, I’ve chosen the version I just installed, which is jdk1.7.0.

Depending on the versions you have installed, you may need to repeat similiarly for:

[[email protected] droidzone]# sudo update-alternatives --config javac
There is only one alternative in link group javac: /usr/lib/jvm/jdk1.7.0/bin/javac
Nothing to configure.


[[email protected] droidzone]# sudo update-alternatives --config javaws
There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.7.0/bin/javaws
Nothing to configure.

You will notice that since I had only single versions of javac and javaws, I didnt need to choose another one. It may just be worthwhile to try these commands anyway.

Confirm that the version of java and javac correspond:

[[email protected] droidzone]# `which java` -version
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)

[[email protected] droidzone]# `which javac` -version
javac 1.7.0_10
[[email protected] droidzone]#


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.