Ubuntu – OpenJDK 8 or 9

software installation

After issuing apt-cache search jdk, I see both openjdk-8-jdk and openjdk-9-jdk listed. I am unsure which one I should install.

I took a look at SDK downloads from Oracle's website below, and I wasn't able to immediately find SDK 9. Why would this be the case?

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Best Answer

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 update-alternatives (which is installed by default 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.

Related Question