Why choose Oracle Java?
Oracle Java is what most Java projects use. They test their products using it. They don't usually test their products on OpenJDK.
This means that bugs get fixed when they show up on Oracle Java. Bugs don't usually get fixed when they show up only on OpenJDK.
If you want a less buggy experience in general, Oracle Java is a better option.
Installing Oracle Java the nice way
Ubuntu's APT package manager makes it easy to install software, uninstall software, and update software. If you want these benefits with Oracle Java, do the following (replace java8
with the version you want; for example, to get Java 9, install oracle-java9-installer
instead):
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
To switch between installed JDKs
List Java alternatives:
update-java-alternatives -l
Find the line with the Java you want.
Remember the first part of the line. For example, Oracle Java 8's line might look like this on your system:
java-8-oracle 1082 /usr/lib/jvm/java-8-oracle
The first part of the line there is java-8-oracle
.
Set the first part of the line you want as the Java alternative (replace java-8-oracle
with the Java you want):
sudo update-java-alternatives -s java-8-oracle