Add the repository and update:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
To install Java 8:
sudo apt-get install oracle-java8-installer
If you have another version already installed, use the following command to add the new version as the default:
sudo apt-get install oracle-java8-set-default
NOTE: If you want to install a previous version of Java such as Java 7 or Java 6, simply replace the version number in the installation command with the desired version, for example, to install Java 7 “sudo apt-get install oracle-java7-installer”
- Tags:
- ubuntu