Installing Java
Debian 10 and Elasticsearch 7.x
Just run
sudo apt install default-jdk
Check installed Java version with
java -version
Debian 8 and Elasticsearch 5.x
The desired version of OpenJDK is not available in out-of-the-box Debian Jessie. So you have to rely on Debian Backports repository and add the following lines to the end of your /etc/apt/sources.list file:
# jessie backports
deb http://http.debian.net/debian jessie-backports main
You can use the nano text editor:
nano /etc/apt/sources.list
The installation of version 8 is then straight forward:
apt-get update
apt-get install -t jessie-backports openjdk-8-jdk
You can also make Java 8 the default:
update-alternatives --config java
Links with more detailed information: