Supporting OpenJFX 11 from JDK11 onwards in e(fx)clipse


So starting with JDK-11 OpenJFX is not part of any downloadable distribution. As JavaFX is designed to run on the module-path (and tested only there) you have 2 options to run JavaFX inside OSGi:
* You create your own JDK-Distribution using jlink
* You launch the VM you want to use JavaFX adding the JavaFX-Modules

While the 2nd solution is doable for RCP-Applications it is less than a nice one, and for integrating into external frameworks (like the Eclipse IDE) it is not possible at all. So we need a different solution to satisfy both usecases.

The solution to this problem is that e(fx)clipse installs a classloader hook using the Equinox AdapterHook-Framework (you can do crazy stuff with that) and on the fly spins up a new Java-Module-Layer containing all the JavaFX-Modules and uses the classloader from the Module-Layer to load the JavaFX-Classes.

With this strategy you can supply the JavaFX-Modules (including the native bits) required for your application to run as part of your p2-repository.

This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Supporting OpenJFX 11 from JDK11 onwards in e(fx)clipse

  1. Christoph Keimel says:

    Awesome!

  2. Pingback: JavaFX links of the week, August 6 | JavaFX News, Demos and Insight // FX Experience

  3. Marcelo says:

    I hope this is the last annoying change you need to tackle Tom, but with Oracle you never know…
    Will this approach also work with Maven based projects?
    Thanks!

  4. ebousse says:

    Hi! Is there a tutorial somewhere that explains how to build an RCP application that has OpenJFX views, and to be able to run this RCP application for instance with a basic JRE from OpenJDK 11 ?

Leave a Reply to Tom Schindl Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.