Chapter 3. Managing Java (for users and administrators)

By default Java programs shipped with Debian will use the java in PATH. Some of them may respect the JAVA_HOME variable (usually only if upstream supports this) or have command line arguments to select a different java implementation.

Unfortunately not all java implementations work as well as others. So some times it may be necessary to change the current java and Debian provides an easy way to change the default java in PATH by using update-java-alternatives (from the java-common). Some examples of how to do this are:

# List available java implementations
$ sudo update-java-alternatives --list
# Use openjdk-7
$ sudo update-java-alternatives --set java-7-openjdk

For more information, please read the manpage (or the --help output) of update-java-alternatives. Also please note that update-java-alternatives is a frontend for update-alternatives.