JavaFX support is in Oracle JDK 9 but missing in Ubuntu OpenJDK 9

Bug #1721852 reported by John Neffenger on 2017-10-06
54
This bug affects 10 people
Affects Status Importance Assigned to Milestone
openjdk-9 (Ubuntu)
Undecided
Unassigned
openjfx (Ubuntu)
Undecided
Unassigned

Bug Description

OpenJDK 9 in Ubuntu 17.10 is missing the JavaFX support found in the upstream release. In the command output below, the file "HelloWorld.jar" is the simple "Hello World" JavaFX application created automatically by NetBeans when you create a new JavaFX Application project.

Upstream Release (JavaFX support included):

JDK 9 General-Availability Release
http://jdk.java.net/9/

$ ~/opt/jdk-9/bin/java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

$ ~/opt/jdk-9/bin/java -jar HelloWorld.jar
Hello World!
Hello World!

Ubuntu Release (missing support for JavaFX):

Package: openjdk-9-jre (9~b181-4) [universe]
https://packages.ubuntu.com/artful/openjdk-9-jre

$ /usr/lib/jvm/java-9-openjdk-amd64/bin/java -version
openjdk version "9-Ubuntu"
OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)
OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)

$ /usr/lib/jvm/java-9-openjdk-amd64/bin/java -jar HelloWorld.jar
Error: Could not find or load main class helloworld.HelloWorld
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-9 (Ubuntu):
status: New → Confirmed
Changed in openjfx (Ubuntu):
status: New → Confirmed
Matthias Klose (doko) wrote :

The OpenJDK binaries distributed by Oracle still includes some code which isn't found in the OpenJDK sources. There is a recent announcement that this will change, however I currently can't find OpenJFX in the OpenJDK sources.

John Neffenger (jgneff) wrote :

The OpenJFX source tree is separate from the OpenJDK sources, but its modules are included as input into the OpenJDK build process. For the OpenJFX source tree, see here:

Getting the Sources
https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX#BuildingOpenJFX-GettingtheSources

Packaging it with the OpenJDK is described here:

Integration with OpenJDK 9
https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX#BuildingOpenJFX-IntegrationwithOpenJDK9

which says:

----------
Build OpenJFX first.

Configure the JDK with the following addition:

  --with-import-modules=_path_to_openjfx/9-dev/build/modular-sdk

Then build the JDK as normal.
----------

I built OpenJFX many times, but I have not yet tried this new procedure for including it in OpenJDK 9. I'm willing to help and try it myself if you run into any problems. I'm eager to see JavaFX finally integrated into the OpenJDK packages on Ubuntu.

Matthias Klose (doko) wrote :

That would create a build dependency on openjfx. I'm not sure if I like that ...

Emmanuel Bourg (ebourg) wrote :

FYI I started working on the openjdk9 package this week.

At some point it might make sense to have default-jre depend on a default-jfx package. Even if OpenJFX is a separate project users now expect to have it automatically on the classpath when they install the JRE.

John Neffenger (jgneff) wrote :

It seems there are still some dependencies being worked out for the build process. See:

Cannot build JavaFX modules with boot JDK that does not already include them
https://bugs.openjdk.java.net/browse/JDK-8189111

The workaround mentioned on the OpenJFX mailing list (<email address hidden>) is to use the Oracle JDK 9 build as the boot JDK.

Emmanuel Bourg (ebourg) wrote :

I eventually managed to build OpenJFX 9 with our openjdk-9 package. But I now realize that integrating it into the JRE isn't going to be as simple as it was for OpenJFX 8. I'll start a thread on debian-java to discuss the options.

In the meantime I pushed my work in progress here:

https://anonscm.debian.org/cgit/pkg-java/openjfx9.git

tags: added: artful
John Neffenger (jgneff) wrote :

I misunderstood what I originally downloaded from the JDK 9 General-Availability Release page (http://jdk.java.net/9/). When Java 9 was first released, that page had a link to the Oracle JDK, not to the OpenJDK. Now that Oracle has released a 9.0.1 update, the OpenJDK is different from the JDK from Oracle and is in fact missing the JavaFX support.

So the upstream OpenJDK does not contain JavaFX support after all. It appears from the mailing list that JavaFX will be included in some later release.

Oracle JDK
http://www.oracle.com/technetwork/java/javase/downloads/index.html

$ ~/opt/jdk-9.0.1/bin/java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

$ ~/opt/jdk-9.0.1/bin/java -jar HelloWorld.jar
Hello World!
Hello World!

Upstream OpenJDK
http://jdk.java.net/9/

$ ~/opt/openjdk-9.0.1/bin/java -version
openjdk version "9.0.1"
OpenJDK Runtime Environment (build 9.0.1+11)
OpenJDK 64-Bit Server VM (build 9.0.1+11, mixed mode)

$ ~/opt/openjdk-9.0.1/bin/java -jar HelloWorld.jar
Error: Could not find or load main class helloworld.HelloWorld
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

John Neffenger (jgneff) on 2018-02-09
summary: - JavaFX support is in upstream OpenJDK 9 but missing in Ubuntu OpenJDK 9
+ JavaFX support is in Oracle JDK 9 but missing in Ubuntu OpenJDK 9
Александр (javasabr) wrote :

I think that openJFX should be included in openJDK.

John Neffenger (jgneff) wrote :

It seems that OpenJFX should continue to be packaged separately, just like any other Java library.

JavaFX was included in Oracle JDK 8 but will be removed in JDK 11, the next long-term support (LTS) release of the JDK. See the following pages for updates on the status of JavaFX in the Oracle JDK:

Oracle Java SE Support Roadmap
http://www.oracle.com/technetwork/java/eol-135779.html

The Future of JavaFX and Other Java Client Roadmap Updates
https://blogs.oracle.com/java-platform-group/the-future-of-javafx-and-other-java-client-roadmap-updates

The associated white paper has more details:

Java Client Roadmap Update
http://www.oracle.com/technetwork/java/javase/javaclientroadmapupdate2018mar-4414431.pdf

The white paper includes the following items in its Executive Summary:

• JavaFX new fixes will continue to be supported on Java SE 8 through March 2022 and removed from Java SE 11.

• Swing and AWT will continue to be supported on Java SE 8 through at least March 2025, and on Java SE 11 (18.9 LTS) through at least September 2026.

• Oracle has begun conversations with interested parties in the Java ecosystem on the stewardship of JavaFX, Swing and AWT beyond the above referenced timeframes.

Samuel Bühner (samuelbu) wrote :

The same problem occurs in Ubuntu 18.04 with OpenJDK 10.
There is only a package for OpenJFX for Java 8 but no package for Java 10

Programs like pdfsam and Cryptomator require JavaFX but I want to use Java 10.

This also leads to bugs like Bug #1768565.

JPT (j-p-t) wrote :

Samuel, that's strange. According to #1799946
in 18.10 there is an OpenJFX package for Java 11 but not for Java 8:

Probably deliver different OpenJFX packages like 8, 10, 11?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions