The OpenJDK provided in debian repository is old than the latest Java version. Some application may require the latest or at least JDK8+ or JRE8+ or maybe both.

The following procedure will install both JDK8 and JRE8 to your system. Follow the instructions to install Oracle Java for latest updates and releases.

1. Add WebUpd8 Oracle Java PPA repository and required keys:

echo "deb xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp:// --recv-keys EEA14886

2. Update APT Cache:

apt-get update

3. Install JDK & JRE using the installer:

apt-get install oracle-java8-installer

4. Check your JDK and JRE versions using:

java -version
javac -version