4

My usage:

I am looking to install Java on Ubuntu 16.04. I don't do any heavy-duty coding, but I was curious what the differences were between Oracle and OpenJDK

What I ran to install

When I run the command

sudo update-alternatives --config java

as suggested here: https://poweruphosting.com/blog/install-java-ubuntu/, I get a prompt saying:

There are 2 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1081      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
* 2            /usr/lib/jvm/java-8-oracle/jre/bin/java          1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

My attempts to answer this question:

I'm coming from OpenJDK - Oracle is better?

Here (OpenJDK vs. Oracle JDK for Android Studio) suggests OpenJDK is

  1. easier to debug but is
  2. slower

Any intense Java users care to weigh in? Thanks!

1 Answer 1

4

Firstly, a JDK consists of a Java Runtime Environment (JRE) and various tools that help you to compile and debug Java code. The JRE is stand-alone and doesn't contain any compiling or debugging tools. So, if you're not into development and just want to run applications written in Java, then you can just install the JRE.

The Oracle JDK is maintained by Oracle (surprise) whereas OpenJDK is an open source implementation with contributions from the open Java community as well as Oracle. As far as I know, Oracle JDK’s build process builds from OpenJDK source code. So, since Oracle JDK gets its source from OpenJDK, there is no major technical difference between Oracle JDK and OpenJDK. My understanding is that all of the development and bug fixes happen in OpenJDK and then they are propagated to the Oracle JDK.

I'll quote this answer here:

In the days of Java 6, there used to be a big difference between the two of them, OpenJDK running slower and supporting less. However, nowadays, except for the java-web-plugin (which was rewritten by the community and named icedtea-web), they are exactly the same. Neither of the two versions is "wrong".

There are still people claiming OpenJDK is worse than Oracle's JDK, but it's become a myth.

There have been instances where people claim that they had issues while running OpenJDK and that got solved when switched over to Oracle JDK or vice versa. But these claims, generally, cannot be verified. Considering the fact that Oracle JDK gets its source from OpenJDK these claims will always be difficult to prove.

Also, on an unrelated note, you can create your own JDK provided you follow the Java language specifications. Many companies (like Twitter) have their own JDKs. Of course, there are certain processes (that I'm currently not aware of) you have to follow before you do that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .