liya
liya

Reputation: 156

JavaFx in oracle JDK 8 is same as openjfx 8 versions or not? what is the relationship between javafx in oracle jdk 8 and openjfx8?

We are moving from Oracle jdk8 to OpenJDK 8. But our system has JavaFX code, which needs to migrate from JavaFX to OpenJFX.

I wonder what is the relationship between JavaFX in Oracle jdk8 and openjfx8. Can anyone explain for me?

Upvotes: 9

Views: 4155

Answers (2)

Basil Bourque
Basil Bourque

Reputation: 340230

Oracle unbundled and open-sourced JavaFX libraries

Oracle was bundling its own implementation of JavaFX with the Java 8 version of its Oracle JDK product.

Later, Oracle discontinued that bundle.

OpenJFX project

And around the same time, Oracle open-sourced its JavaFX implementation, making that source code a sub-project on the OpenJDK project. That sub-project is known as OpenJFX (as Oracle retains commercial rights to its “Java” branding). See its GitHub page, and its OpenJDK wiki page.

Oracle now shares leadership for OpenJFX development with the Gluon company. Gluon sells support, licenses for additional libraries, and services. Oracle may sell support as well.

OpenJFX is actively developed. A major release arrives around the same time as every major release of Java. Java 17 will released this month (2021-09), and OpenJFX 17 version is already available. JavaFX 17 requires JDK 11 or later. See Release Notes for JavaFX 17.

See the OpenJFX site for more info and developer documentation: https://openjfx.io/

Oracle JDK is built from OpenJDK

You said:

We are moving from oracle jdk8 to openjdk 8

The Oracle JDK product is based on OpenJDK. Oracle has committed to feature parity between them. The only differences are that (a) Oracle sells support for Oracle JDK and requires a fee when used in production (but not for development and testing), and (b) Oracle reserves the right to ship immediately any necessary fixes directly to its paying customers without waiting for the fix to wind its way through the OpenJDK process.

Options for deploying JavaFX/OpenJFX libraries

The current versions of Oracle JDK no longer bundle the JavaFX libraries. So no matter what distribution of Java you choose (Pivotal, Azul Systems, Microsoft, SAP, Amazon, BellSoft, Oracle, Red Hat/IBM, Adoptium/AdoptOpenJDK, etc.), you will need to address the issue of providing the necessary OpenJFX libraries.

One option is bundling the libraries with your app. The new jlink and jpackage tools might help.

Another option is putting a copy of the OpenJFX libraries on the class path of your user’s machines.

A third option is using a JDK distribution that includes the OpenJFX libraries. At least two companies provide a variation of their JDK distributions that include OpenJFX:

  • ZuluFX from Azul Systems.
  • LibericaFX from BellSoft.

OpenJFX starts at version 11

You said:

But our system has javafx code, which needs migrate from javafx to openjfx?

I see only versions of OpenJFX numbered 11 through 18. Only OpenJFX 11 and 17 will have long-term support.

They recommend Java 16 for OpenJFX, with a minimum requirement of Java 11. So you may not be able to migrate your Java 8 based project to OpenJFX.

Suggestion: Migrate to versions 17

Java 17 is due this month, and is expected to be designated a long-term support (LTS) version. I suggest you consider updating your Java 8 app to Java 17 and OpenJFX 17. Both Java and JavaFX have evolved by leaps and bounds since versions 8.

First study the Answer by jewelsea discussing technical changes through the various versions of JavaFX & OpenJFX. Then carefully read through all the Release Notes for both product lines, keeping notes of any potential issues for your app. Then give it a try. Try converting, see what problems arise. Take a shot at fixing them. If you eventually succeed, you’ll be well placed for the future.

Resources

You may want to read these white papers:

Upvotes: 10

jewelsea
jewelsea

Reputation: 159576

Background

This information is supplemental to Basil's excellent answer, which already comprehensively covers the majority of relevant information on this topic.

This question was specifically about JavaFX 8, which is now obsolete. The feature difference information here is provided for historical purposes.

It is highly recommended that any existing projects migrate from JavaFX 8 to a recent JavaFX version, and that any new projects use a recent JavaFX version (e.g. JavaFX 17+), which is based on the openjfx source.

What was Oracle JDK 8 and what was JavaFX 8 in OpenJDK?

Oracle JDK 8 was a distribution of the JDK and JRE which included an implementation of JavaFX 8.

JavaFX 8 was open-sourced as part of the OpenJDK project. You can find a link to JavaFX 8 source from the OpenJDK project at at the openjdk github site (external link may disappear or die some day in the future).

The Oracle JDK 8 was largely built from those open source components, plus a couple of closed source components as outlined below.

It was possible to build a complete version of OpenJDK 8 that included JavaFX 8 using only open-source code (less the features from the closed source outlined below).

However, many OpenJDK 8 based distributions (e.g. those that shipped as JDK and JRE implementations for common Linux distributions), did not include the JavaFX implementation portions of the OpenJDK project.

Also, third-party JDK distributions from vendors such as IBM also did not include a JavaFX implementation.

Thus, for JavaFX 8 development the primary distribution in use was Oracle JDK/JRE 8, not distributions that contained only the OpenJDK implementation for JavaFX 8.

Oracle JDK 8 and OpenJDK 8 source Implementation/Feature Differences

This information is based on info at:

I can no longer find links to official sources on the net which describe these differences.

Oracle JDK 8 implements some features that are not available from the OpenJDK 8 open-source implementation. The components that relate to JavaFX:

  1. The ON2 VP6 video codec, which is owned by Google and that Google had not open-sourced (when I last checked).
  • This means that an open version of JavaFX cannot play VP6 FLV files. This is not a big loss as it is difficult to find VP6 encoders or media encoded in VP6.
  • Other more common video formats, such as H.264 will playback fine with an open version of JavaFX (as long as you have the appropriate codecs pre-installed on the target machine).
  1. The Oracle WebStart/Browser Embedded application deployment technology.
  • The lack of WebStart/Browser Embedded deployment technology is really something to do with OpenJDK itself rather than JavaFX specifically. This technology can be used to deploy non-JavaFX applications.
  1. I think some versions of Oracle JDK 8 and the OpenJDK JavaFX implementation shipped with differing 2D renderers.
  • Oracle JDK shipped with a closed source renderer implementation and OpenJDK shipped with a different open-source renderer.
  • This was an internal implementation detail, I don't think there were any functional feature differences between the implementations.
  1. Possibly some other minor differences that I am not aware of.

For most users, with the possible exception of the lack of WebStart/Applet support, the functional/feature differences between the two versions were immaterial.

There were differences in the licensing models for the Oracle JDK implementation that include JavaFX and JavaFX versions built purely from the OpenJFX project source within OpenJDK. If these licensing difference details are important to you, I encourage you to do your own research into the topic.

JavaFX 9 & 10

As of Java 9, VP6 encoding was deprecated for JavaFX, and the Oracle WebStart/Browser embedded application deployment technology was also deprecated.

So, although this functionality was included in these releases in the Oracle SDK and not the OpenJFX source, the technology was already marked for future removal (which occurred by the JDK/JRE/JavaFX 11 releases, if not earlier).

JavaFX 11+

For JavaFX 11+, the information on feature differences above is completely irrelevant as the download page for JavaFX 11+ states:

As of JDK 11, the javafx.* modules are no longer included as part of the JDK. They are now distributed separately as a standalone, unbundled release of OpenJFX. They are available either as maven artifacts for use with Maven/Gradle or as a standalone SDK that includes jmod files for use with jlink.

So, there is no such thing as an Oracle-specific version of JavaFX for Java 11+ (as far as I know), for those versions, there is only the modules available from the open-source openjfx project (or other distributions that created their packaging based on the single openjfx source).

For further information on JavaFX 11+, see either the openjfx.io framework user site or the internal openjfx developer site.

Upvotes: 4

Related Questions