e(fx)clipse support for Java9


Approximately a month ago we started to the work to run e(fx)clipse applications on Java9. We had to clean up our codebase a bit because sometimes we called into none-public API (eg impl_*) who has been made private or released as public API, used all sorts of reflection hacks (eg to get Tab-DnD working) who break on Java9 for obvious reasons.

It’s been quite some work but finally things are working!

The screenshot shows an sample e4 application I’ve written to get myself used to the new module-system API:

screen-j9

Supporting Java9 is a critical thing for the future of the e(fx)clipse platform but as important is that we won’t force you to use Java9 with JPMS but keep e(fx)clipse compatible to Java8 and Java9 for the 3.x and maybe 4.x stream.

To help us supporting both platforms we encapsulated API calls who are different in Java8 and Java9 into a small utility class you can make use of in your JavaFX applications just by adding a (maven) dependency on

...
  <repositories>
    <repository>
      <name>BestSolution e(fx)clipse releases</name>
      <id>efxclipse-releases</id>
      <url>http://maven.bestsolution.at/efxclipse-releases/</url>
     </repository>
     <repository>
       <name>BestSolution e(fx)clipse snapshots</name>
       <id>efxclipse-snapshots</id>
       <url>http://maven.bestsolution.at/efxclipse-snapshots/</url>
       <snapshots>
         <enabled>true</enabled>
        </snapshots>
      </repository>
  </repositories>
  <dependencies>
    ...
    <dependency>
      <groupId>at.bestsolution.efxclipse.rt</groupId>
      <artifactId>org.eclipse.fx.ui.controls</artifactId>
      <version>3.0.0-SNAPSHOT</version>
    </dependency>
    ...
  <dependencies>
...

in your Java code add a static import for org.eclipse.fx.ui.controls.JavaFXCompatUtil and if you eg want get all currently available windows just do it like this code snippet

import static org.eclipse.fx.ui.controls.JavaFXCompatUtil.*

// ...

JavaFXCompatUtil.getWindows();

Currently we use Reflection to switch between Java9 and Java8 APIs but in future multi-version jars might also be a solution.

To sum up I’m happy things are working so smooth on Java9, the only sad thing is that our performance hack to turn off the JavaFX-CSS-Engine under certain conditions does not work anymore in Java9 and we won’t be able to implement a replacement.

Advertisements
This entry was posted in e(fx)clipse, Uncategorized. Bookmark the permalink.

3 Responses to e(fx)clipse support for Java9

  1. Pingback: JavaFX links of the week, February 13 | JavaFX News, Demos and Insight // FX Experience

  2. Oliver says:

    Pretty impressive!

    A couple of months back you had a proof of concept showing the eclipse platform rendered with a JFX backend instead of SWT. Is this still a thing?

  3. Pingback: JavaFX Sixpack: Java 9 in e(fx)clipse und die Zukunft von JavaFX

Leave a 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s