Firstly, check your current version of JRE

java -version

You should get something like this:

java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-2~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

Install Java 8

Install Java 8 Runtime Enviroment:

sudo apt-get update
sudo apt-get install openjdk-8-jre

Now, check Java version, again:

java -version

Update java path

In case you still get the old version, then you should update the java path using the following command:

sudo update-alternatives --config java

you should get something like this:

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                    Priority   Status
* 0            /path-to/java-7-openjdk.../jre/bin/java   #      auto mode
  1            /path-to/java-7-openjdk.../jre/bin/java   #      manual mode
  2            /path-to/java-8-openjdk.../jre/bin/java   #      manual mode

Press enter to keep the current choice[*], or type selection number:

Finally choose the option for Java 8 - in the above case, number 2.