Remove JavaFX JPMS enforcement

Mohammad Saleem Yusuf saleem_yusuf at hotmail.com
Sat Apr 18 16:32:20 UTC 2020


Michael,
I completely agree with you. I am Professor at a community college (NHTI) and teach entry level courses to students who have just graduated from high school.
About a year ago (JDK 8 to 11), I started including Java FX in my Java course, but after that I had to remove it (JDK > 11.03) as the Oracle examples on web stopped working. I noticed that the textbook I use (Java, The Complete Reference 11 ed, Oracle Press) also took Java FX out.

I really like JavaFX and I also teach Microsoft and Google (Android) courses. For GUI, they also use similar technologies in WPF, UWP and Android Development. It would be very helpful to make Java FX use easy again, so students start using Java FX again. I tried for a while but gave as I don't have to time to do all the research and install additional software.

M. Saleem Yusuf



-----Original Message-----
From: openjfx-dev <openjfx-dev-bounces at openjdk.java.net> On Behalf Of Michael Paus
Sent: Saturday, April 18, 2020 6:01 AM
To: OpenJFX <openjfx-dev at openjdk.java.net>
Subject: Remove JavaFX JPMS enforcement

Getting started with JavaFX is made overly complicated by the fact that the use of the module system is enforced by some code in the JDK. Especially for beginners, who just want to get some small program running, this is almost always a big source of frustration.
It is not very good marketing for JavaFX to make these initial steps such a pain. If you need some evidence for this statement, then just follow JavaFX on Stackoverflow or similar sites (and also this mailing list). Almost every day you can read frustrated posts from helpless people who would just like to get some JavaFX project running but are failing because they get lost in the module system jungle.

In order to make JavaFX more easily accessible, especially for beginners, I'd like to start a discussion here about the possibility to unconditionally remove the JavaFX JPMS enforcement. IMHO this enforcement is simply not necessary and is just the root for a lot of frustration with JavaFX. It should just be possible to put all the JavaFX jars on the classpath (instead of the module path) like you would do with any other external dependency in a non-modular setup.

With a not very intuitive hack you can circumvent this problem already now.
Just add a line like this to the file which contains your main class extending Application (MyApp).

class MyAppLauncher {public static void main(String[] args) {MyApp.main(args);}}

Because of this launcher it is now possible to put all dependencies and all JavaFX jars on the classpath and to completely forget the module system with all its intricacies and pitfalls.
But why should people be forced to use such dirty tricks? The better alternative would be to just lift the current constraint.

I am using this trick for a long time now, even on bigger projects, and I have never ever experienced any problem resulting from this. Even in theory I don't know anything that could prevent a formally correct module jar to also work on the classpath (which is of course not true the other way round). Therefore I say that this constraint is just not necessary and only does a lot of damage to JavaFXs reputation.

I'd now like to have some feedback of the community about this.

Michael




More information about the openjfx-dev mailing list