Differences between Oracle JDK and OpenJDK

后端 未结 11 1253
囚心锁ツ
囚心锁ツ 2020-11-22 12:01

NOTE: This question is from 2014. As of Java 11 OpenJDK and Oracle JDK are converging.

Are there any crucial differences between Ora

相关标签:
11条回答
  • 2020-11-22 12:14

    For Java 7, nothing crucial. The OpenJDK project is mostly based on HotSpot source code donated by Sun.

    Moreover, OpenJDK was selected to be the reference implementation for Java 7 and is maintained by Oracle engineers.

    There's a more detailed answer from 2012 on difference between JVM, JDK, JRE & OpenJDK, which links to an Oracle blog post:

    Q: What is the difference between the source code found in the OpenJDK repository, and the code you use to build the Oracle JDK?

    A: It is very close - our build process for Oracle JDK releases builds on OpenJDK 7 by adding just a couple of pieces, like the deployment code, which includes Oracle's implementation of the Java Plugin and Java WebStart, as well as some closed source third party components like a graphics rasterizer, some open source third party components, like Rhino, and a few bits and pieces here and there, like additional documentation or third party fonts. Moving forward, our intent is to open source all pieces of the Oracle JDK except those that we consider commercial features such as JRockit Mission Control (not yet available in Oracle JDK), and replace encumbered third party components with open source alternatives to achieve closer parity between the code bases.

    0 讨论(0)
  • 2020-11-22 12:15
    1. Oracle will deliver releases every three years, while OpenJDK will be released every six months.
    2. Oracle provides long term support for its releases. On the other hand, OpenJDK supports the changes to a release only until the next version is released.
    3. Oracle JDK was licensed under Oracle Binary Code License Agreement, whereas OpenJDK has the GNU General Public License (GNU GPL) version 2 with a linking exception.
    4. Oracle product has Flight Recorder, Java Mission Control, and Application Class-Data Sharing features, while OpenJDK has the Font Renderer feature.Also, Oracle has more Garbage Collection options and better renderers,
    5. Oracle JDK is fully developed by Oracle Corporation whereas the OpenJDK is developed by Oracle, OpenJDK, and the Java Community. However, the top-notch companies like Red Hat, Azul Systems, IBM, Apple Inc., SAP AG also take an active part in its development.

    From Java 11 turn to a big change

    Oracle will change its historical “BCL” license with a combination of an open source and commercial license

    • Oracle’s kit for Java 11 emits a warning when using the -XX:+UnlockCommercialFeatures option, whereas in OpenJDK builds, this option results in an error
    • Oracle JDK offers a configuration to provide usage log data to the “Advanced Management Console” tool
    • Oracle has always required third party cryptographic providers to be signed by a known certificate, while cryptography framework in OpenJDK has an open cryptographic interface, which means there is no restriction as to which providers can be used
    • Oracle JDK 11 will continue to include installers, branding, and JRE packaging, whereas OpenJDK builds are currently available as zip and tar.gz files
    • The javac –release command behaves differently for the Java 9 and Java 10 targets due to the presence of some additional modules in Oracle’s release
    • The output of the java –version and java -fullversion commands will distinguish Oracle’s builds from OpenJDK builds


    Update : 25-Aug-2019



    for more details oracle-vs-openjdk

    0 讨论(0)
  • 2020-11-22 12:21

    A key difference going forward is the release schedule and support policy.

    OpenJDK

    OpenJDK will have a feature release every 6 months which is only supported until the next feature release. It's essentially a continuous stream of releases targeted to developers.

    Oracle JDK

    The Oracle JDK is targeted more towards an enterprise audience which values stability. It's based on one of the OpenJDK releases but is then given long term support (LTS). The Oracle JDK has releases planned every 3 years.

    Source: https://www.oracle.com/java/java9-screencasts.html?bcid=5582439790001&playerType=single-social&size=events

    0 讨论(0)
  • 2020-11-22 12:27

    Also for Java 8 an interesting performance benchmark for reactive (non-blocking) Spring Boot REST application being hosted on various JVMs by AMIS Technology Blog has been published in Nov 2018 showing that, among other differences:

    • OpenJDK has higher CPU usage than OracleJDK,
    • OpenJDK has slightly lower response time than OracleJDK,
    • OpenJDK has higher memory usage than OracleJDK,

    For details please see the source article.

    Of course YMMV, this is just one of the benchmarks.

    0 讨论(0)
  • 2020-11-22 12:29

    According to the oracle blog, Oracle JDK Releases for Java 11 and Later

    Starting with Java 11, Oracle will provide JDK releases under the open source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE), and under a commercial license for those using the Oracle JDK as part of an Oracle product or service, or who do not wish to use open source software. This combination of using an open source license and a commercial license replaces the historical “BCL” license, which had a combination of free and paid commercial terms.

    Different builds will be provided for each license, but these builds are functionally identical aside from some cosmetic and packaging differences, described in detail below.

    From the BCL to the GPL

    The Binary Code License for Oracle Java SE technologies (“BCL”) has been the primary license for Oracle Java SE technologies for well over a decade. The BCL permits use without license fees under certain conditions. To simplify things going forward, Oracle started providing open source licensed OpenJDK builds as of Java 9, using the same license model as the Linux platform. If you are used to getting Oracle Java SE binaries for free, you can simply continue doing so with Oracle’s OpenJDK builds available at jdk.java.net. If you are used to getting Oracle Java SE binaries as part of a commercial product or service from Oracle, then you can continue to get Oracle JDK releases through My Oracle Support (MOS), and other locations.

    Functionally identical and interchangeable...

    Oracle’s BCL-licensed JDK historically contained “commercial features” that were not available in OpenJDK builds. As promised, however, over the past year Oracle has contributed these features to the OpenJDK Community, including:

    • Java Flight Recorder,
    • Java Mission Control,
    • Application Class-Data Sharing, and
    • ZGC.

    From Java 11 forward, therefore, Oracle JDK builds and OpenJDK builds will be essentially identical.

    ...yet with some cosmetic and packaging differences

    There do remain a small number of differences, some intentional and cosmetic, and some simply because more time to discuss with OpenJDK contributors is warranted.

    • Oracle JDK 11 emits a warning when using the -XX:+UnlockCommercialFeatures option, whereas in OpenJDK builds this option results in an error. This option was never part of OpenJDK and it would not make sense to add it now, since there are no commercial features in OpenJDK. This difference remains in order to make it easier for users of Oracle JDK 10 and earlier releases to migrate to Oracle JDK 11 and later.
    • Oracle JDK 11 can be configured to provide usage log data to the “Advanced Management Console” tool, which is a separate commercial Oracle product. We will work with other OpenJDK contributors to discuss how such usage data may be useful in OpenJDK in future releases, if at all. This difference remains primarily to provide a consistent experience to Oracle customers until such decisions are made.
    • The javac --release command behaves differently for the Java 9 and Java 10 targets, since in those releases the Oracle JDK contained some additional modules that were not part of corresponding OpenJDK releases:
      • javafx.base
      • javafx.controls
      • javafx.fxml
      • javafx.graphics
      • javafx.media
      • javafx.web
      • java.jnlp
      • jdk.jfr
      • jdk.management.cmm
      • jdk.management.jfr
      • jdk.management.resource
      • jdk.packager.services
      • jdk.snmp

    This difference remains in order to provide a consistent experience for specific kinds of legacy use. These modules are either now available separately as part of OpenJFX, are now in both OpenJDK and the Oracle JDK because they were commercial features which Oracle contributed to OpenJDK (e.g., Flight Recorder), or were removed from Oracle JDK 11 (e.g., JNLP).

    • The output of the java --version and java -fullversion commands will distinguish Oracle JDK builds from OpenJDK builds, so that support teams can diagnose any issues that may exist. Specifically, running java --version with an Oracle JDK 11 build results in:

    java 11 2018-09-25

    Java(TM) SE Runtime Environment 18.9 (build 11+28)

    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

    And for an OpenJDK 11 build:

    openjdk version "11" 2018-09-25

    OpenJDK Runtime Environment 18.9 (build 11+28)

    OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

    • The Oracle JDK has always required third party cryptographic providers to be signed by a known certificate. The cryptography framework in OpenJDK has an open cryptographic interface, meaning it does not restrict which providers can be used. Oracle JDK 11 will continue to require a valid signature, and Oracle OpenJDK builds will continue to allow the use of either a valid signature or unsigned third party crypto provider.
    • Oracle JDK 11 will continue to include installers, branding and JRE packaging for an experience consistent with legacy desktop uses. Oracle OpenJDK builds are currently available as zip and tar.gz files, while alternative distribution formats are being considered.
    0 讨论(0)
提交回复
热议问题