A quick reference for Debian Linux users who are going to install Oracle Java 7.
Getting Oracle Java 7
At first you should obtain your own copy of JDK/JRE from the Java SE Downloads page. Just Accept License Agreement and you’ll be able do download suitable gzipped tarball.
File system preparation
Then extract downloaded archive to an installation directory. In my case it is
In order to be able to update Java installation create an easy-to-use structure of symbolic links
1 2 3
When you decide to change or update Java installation you just need to point
one of the
default symbolic links to an appropriate installation.
/usr/java/default path will be used in the rest of the reference.
Installing an alternative
The Debian alternatives system maintains software with the same or similar functionality of different version which are installed simultaneously but with one particular implementation designated as the default.
So we are going to use it to install yet another alternative.
/usr/bin/javais a generic name (or alternative link), which refers, via the alternatives system, to one of a number of files of similar function
java– alternative name of a symbolic link in the alternatives directory
/usr/java/default/bin/javais the alternative path which is a name of a specific file in the filesystem, which may be made accessible via a generic name using the alternatives system
300is a priority of the given alternative.
In order to check our Java installation and choose one run
and you should see something like that:
1 2 3 4 5 6 7 8 9
Select an appropriate one by typing its number (in my case it’s 1) and the fresh installed Oracle Java 7 will be used on your Debian machine.
Verifying the installation
When you execute
you should see
1 2 3
Setting $JAVA_HOME environment variable
If you’ve installed JDK and you are planning to use your machine in Java development you should set $JAVA_HOME environment variable in the global system /etc/bash.bashrc bash configuration or in your user’s local ~/.bashrc one.
Just add the following lines at the end of the chosen bash configuration
1 2 3
And apply the changes by executing
After that your should be able to reach Java Compiler and others from JDK.
Just verify it.