Installing OpenJDK on Debian-based systems

Steps for installing OpenJDK 8 on Debian-based systems.

Configure your operating system to use the OpenJDK 8.


In a terminal:

  1. Install the OpenJDK 8 from a PPA repository:
    sudo add-apt-repository ppa:openjdk-r/ppa
  2. Update the system package cache and install:
    sudo apt-get update
    $ sudo apt-get install openjdk-8-jdk
  3. If you have more than one Java version installed on your system use the following command to switch versions:
    sudo update-alternatives --config java
  4. Make sure your system is using the correct JDK:
    java -version
    openjdk version "1.8.0_72-internal"
    OpenJDK Runtime Environment (build 1.8.0_72-internal-b05)
    OpenJDK 64-Bit Server VM (build 25.72-b05, mixed mode)