7

I read at Technically what is the main difference between Oracle JDK and Open JDK? the

"Oracle JDK is an implementation of the OpenJDK and is not open source"

But JDK source code is openly available and free . Right . So how come its not open source ? May be i am wrong here in judging the oracle JDK as open source because source code may be available and free but is it not allowed to modify/extend and redistribute it further, that why it is not open source ?

Community
  • 1
  • 1
scott miles
  • 1,511
  • 2
  • 21
  • 36

2 Answers2

11

But [the Oracle] JDK source code is openly available and free. Right?

Strictly speaking, No.

1) The full source code for the Oracle JDK is not available. The JDK source code ZIP file only contains the source code for the public class library APIs. Not some of the "internal" class. Not the JDK / JRE toolchains. Not the JVM runtime itself; e.g. the JIT compiler, GC implementations, the verifier, etc.

2) For the subset that is available you need to accept an Oracle license.

3) The source code that is available says in the copyright headers that it is Oracle (or Sun) proprietary.

So how come its not open source?

See above.

May be i am wrong here because source code may be available and free but is it not allowed to modify/extend and redistribute it further, that why it is not open source ?

That is one reason.

Open source doesn't just mean that source code is available for free. It it also available without undue restrictions on what you can do with it.

(And if you want the full source code for Oracle JDK, then it is not available for free, and the terms and conditions are pretty restrictive.)


By contrast the OpenJDK codebase is covered by GPLv2 (with the "Classpath exception" which clarifies the point that an application built to use the OpenJDK JVM / class libraries is not subject to the GPL.) Everything that is part of OpenJDK is available as source code ... without you signing anything.

Sure the GPL places restrictions on what you can do, but those are designed to make the code free (as in liberty) and protect the rights of the end-user.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • when you say full source code for oracle jdk is not available .. But i see all source code available for Java api's. May be you mean source code may not be available for other JDK components like jconsole etc Is that right ? – scott miles Sep 25 '16 at 08:09
  • That is correct. Also, the source code for the Oracle JVM itself is not included. – Stephen C Sep 25 '16 at 08:11
  • one more thing on Oracle JDK am i allowed to modify source code for my purpose and use it in my production if i do not redistribute the modified code to anyone else ? – scott miles Sep 25 '16 at 08:16
  • 1
    @scottmiles the oracle JDK has a "You must accept this binary license" thing you must click before you can download it. I suggest you read that binary license very carefully. – Thorbjørn Ravn Andersen Sep 25 '16 at 08:22
  • The Oracle Binary license forbids that is you want to redistribute. Not sure about "internal use only". Either way, I recommend using OpenJDK if you intend to modify anything. But even then, you may find that the Oracle >>trademark<< restrictions apply; i.e. you can't called your modifications "Java". – Stephen C Sep 25 '16 at 08:27
  • Stephen that comment was also valuable . May be you could modify it to include oracle JDK too :) – scott miles Sep 25 '16 at 08:27
  • OK. I don't recommend using Oracle JDK if you intend to modify things. Happy? ;-) – Stephen C Aug 16 '17 at 15:34
  • @StephenC Oracle now provides [JDK 11 General-Availability Release under GNU GPL v2](https://jdk.java.net/11/). – Pikalek Sep 26 '18 at 14:30
  • @Pikalek - That is only for OpenJDK. As previously, the binary builds are under a non-open-source binary license. Like it says on the page you liked to. And there is another catch. Oracle will no longer be putting effort into back-patching older OpenJDK releases once the next 6-monthly release is available. If you want that, you either pay for a support contract or rely on a 3rd party supplier; see the "Java is Still Free" document linked here: https://blog.adoptopenjdk.net/2018/09/java-is-still-free-and-adoptopenjdk-adds-to-your-choices – Stephen C Sep 27 '18 at 11:22
  • @StephenC Yes, I was mistaken. Since the pg didn't explicitly say OpenJDK, I incorrectly concluded it was a different build. But the actual download file is labelled OpenJDK. Thanks for bringing this to my attention & for the "Java is Still Free" link. – Pikalek Sep 27 '18 at 13:37
1

OpenJDK is open source under the GPL v2 license, whereas OracleJDK uses Oracle Binary Code License Agreement (more on that here and here).

You're not wrong when you say that the source code is freely available but it's not allowed to be modified and redistributed further.

Nikhil Vibhav
  • 120
  • 1
  • 4
  • 11