How did I install Oracle Java 13 for Elasticsearch 6.8 to Debian 10?

Step 1

apt install wget libasound2 libasound2-data

Step 2

wget \
  --header "Cookie: oraclelicense=accept-securebackup-cookie" \
  --no-check-certificate \
  --no-cookies \

It is the URL for Oracle Java 13.0.2.
You can get the URL of the latest version here:

Step 3

dpkg -i jdk-13.0.2_linux-x64_bin.deb

If you used a custom URL on the Step 2, then adjust the file name for the dpkg command.

Step 4

update-alternatives --install /usr/bin/java java  /usr/lib/jvm/jdk-13.0.2/bin/java 2
update-alternatives --config java
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-13.0.2/bin/jar 2
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13.0.2/bin/javac 2
update-alternatives --set jar /usr/lib/jvm/jdk-13.0.2/bin/jar
update-alternatives --set javac /usr/lib/jvm/jdk-13.0.2/bin/javac

Replace 13.0.2 with your version.

Step 5

Check the installation:

java -version


Step 6

Create /etc/profile.d/ with the following contents:

export DERBY_HOME=/usr/lib/jvm/jdk-13.0.2/db
export J2REDIR=/usr/lib/jvm/jdk-13.0.2
export J2SDKDIR=/usr/lib/jvm/jdk-13.0.2
export JAVA_HOME=/usr/lib/jvm/jdk-13.0.2
export PATH=$PATH:/usr/lib/jvm/jdk-13.0.2/bin:/usr/lib/jvm/jdk-13.0.2/db/bin

Step 7

source /etc/profile.d/

See also: How did I install OpenJDK 1.8 for Elasticsearch 6 to Debian 9?