First, delete openjdk:
Second, add PPA:
[Email protected]:~# add-apt-repository Ppa:webupd8team/java The program ' Add-apt-repository ' was currently not installed. You can install it by typing:apt install Software-properties-common
The above tip is because the add-apt-repository command does not exist and can be installed:
Apt Install Software-properties-common
Then execute the command to add the PPA:
[email protected]:~# add-apt-repository Ppa:webupd8team/java Oracle java (JDK) Installer (automatically downloads and installs Oracle Jdk7/jdk8/jdk9). There is no actual Java files in this PPA. More info (and Ubuntu installation instructions):-For Oracle Java 7:http://www.webupd8.org/2012/01/ Install-oracle-java-jdk-7-in-ubuntu-via.html-for Oracle Java 8:http://www.webupd8.org/2012/09/ install-oracle-java-8-in-ubuntu-via-ppa.html Debian Installation instructions:-Oracle Java 7:http://www.webupd8.org /2012/06/how-to-install-oracle-java-7-in-debian.html-oracle Java 8:http://www.webupd8.org/2014/03/ How-to-install-oracle-java-8-in-debian.html Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/ Install-oracle-java-9-in-ubuntu-linux.html for JDK9, the PPA uses standard builds from:https://jdk9.java.net/download/ (And not the Jigsaw builds!). Important!!! For now, you should continue to use Java 8 because Oracle Java 9 are available as an early access relEase (it should is released in 2016)! You should only use Oracle Java 9 If you explicitly need it, because it may contain bugs and it might not include the late St Security Patches! Also, some Java options were removed in JDK9, so if encounter issues with various Java apps. More information and installation instructions (Ubuntu/linux Mint/debian): Http://www.webupd8.org/2015/02/install-ora cle-java-9-in-ubuntu-linux.html more info:https://launchpad.net/~webupd8team/+archive/ubuntu/javapress [ENTER] to Continue or ctrl-c to cancel adding it gpg:keyring '/tmp/tmp08u3_3hk/secring.gpg ' createdgpg:keyring '/tmp/tmp08u3_3hk/p UBRING.GPG ' createdgpg:requesting key EEA14886 from HKP server keyserver.ubuntu.comgpg:/tmp/tmp08u3_3hk/trustdb.gpg: Trustdb createdgpg:key eea14886:public Key "Launchpad VLC" Importedgpg:no ultimately trusted keys foundgpg:total Numbe R processed:1gpg:imported:1 (rsa:1) OK
Third, update Source: sudoapt-get update
Iv. installation of Jdk1.8:sudoapt-get install Oracle-java8-installer When the number is modified to 6, 7, JAVA6 (or 7) will be installed. V. Setting the default JDK (config environment variable): sudoapt-get install Oracle-java8-set-default Similarly, after modifying the number to 6 or 7, the default Java version will be set to 6 or 76 and the version should be viewed:root@ubuntu:~# java-version Java version "1.8.0_91" java (tm) se runtime environment ( build 1.8.0_91 -b14) Java HotSpot(TM) -Bit Server VM (build 25.91 -B14, mixed mode) Version switching: sudoUpdate-Java-alternatives -s java-8-Oracle
Uninstalling the JDK:sudo apt-get remove Oracle-java8-installer
Ubuntu16.04 PPA mode installation JDK1.8