http://www.rpiblog.com/2014/03/installing-oracle-jdk-8-on-raspberry-pi.html or https://www.raspinews.com/installing-oracle-java-jdk-8-on-raspberry-pi/ or https://discourse.osmc.tv/t/oracle-java-8/37092/2 plus https://discourse.osmc.tv/t/how-to-install-jdownloader2-gui-vnc/36018
cd ~/Downloads/
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-arm32-vfp-hflt.tar.gz
cd /opt
sudo cp ~/Downloads/jdk-8u162-linux-arm32-vfp-hflt.tar.gz .
sudo tar zxfv ./jdk-8u162-linux-arm32-vfp-hflt.tar.gz -C /opt
sudo chown -R root:root ./jdk1.8.0_162
ls -lah
you should see folder with proper owner and permissions:
drwxr-xr-x 8 root root 4,0K ene 29 17:23 jdk1.8.0_162
-rw-r--r-- 1 root root 78M ene 29 17:22 jdk-8u162-linux-arm32-vfp-hflt.tar.gz
sudo rm jdk-8u162-linux-arm32-vfp-hflt.tar.gz
sudo update-alternatives --install "/usr/bin/java" "java" /opt/jdk1.8.0_162/bin/java 1
sudo update-alternatives --config java
java -version