OpenJDK 8 or 9?

Solution 1:

If you are planning to install NetBeans then install openjdk-8-jdk because openjdk-9-jdk is not compatible with NetBeans from the default Ubuntu repositories, at least it is not compatible with NetBeans in Ubuntu 16.04. The version of NetBeans in 16.04 is NetBeans 8 which targets Java 8 as its compatible Java version. NetBeans from the default Ubuntu 18.04 and later repositories, is compatible with openjdk-11-jdk.

Another alternative is to install both openjdk-8-jdk and openjdk-9-jdk and use either sudo update-alternatives --config java (update-alternatives is provided by default by dpkg in Ubuntu) or update-java-alternatives (which is installed when openjdk-8-jdk is installed) to manually choose which Java to use before running an application. See update-java-alternatives vs update-alternatives --config java.

Solution 2:

Java 9 is still in development. You can find official downloads of it at http://jdk.java.net/9/. Which version you should download is entirely a a question of what you plan to do with it.

Edit: It has been officially released on 2017 Sep.