$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update
Once PPA has been added and updated, now search for the packages with name oracle-java8 and install it as shown.
$ apt-cache search oracle-java8 $ sudo apt-get install oracle-java8-installer
If you have more than one Java installed on your system, you can install oracle-java8-set-default package to set Java 8 as default as shown.
$ sudo apt-get install oracle-java8-set-default # java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) root@zbook /usr/local/netbeans-8.2/bin #
$ chmod +x netbeans-8.2-linux.sh $ ./netbeans-8.2-linux.sh