JDK-8261668 : JavaFX apps don't run anymore with JavaFX 16-ea+7 without JPMS
  • Type: Bug
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Affected Version: openjfx16
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2021-02-12
  • Updated: 2021-02-13
  • Resolved: 2021-02-13
Related Reports
Relates :  
Description
All my JavaFX apps don't run anymore with JavaFX 16-ea+7 when started like this:
class MyAppLauncher {public static void main(String[] args) {MyApp.main(args);}}
where MyApp extends Application. This avoids using the JPMS and has worked always up to now.

All I get is this warning: 2021-02-12 18:30:31 [WARNING][com.sun.javafx.application.PlatformImpl startup] Unsupported JavaFX configuration: classes were loaded from 'unnamed module @2c4231' 

and then there is silence. The app just hangs and does not show any GUI.
I know that such a warning was going to be introduced but up to now my understanding was that this is just that - a warning.

This was tested on macOS 10.15.7 starting several apps from within Eclipse and as a standalone packaged application.
Comments
Great, so I presume you can fix this in your app. I'll close this bug as "not an issue".
13-02-2021

I have found the bug. The issue is indeed caused by the message which is issued by the JavaFX launcher. Logging this message causes an interference with Java logging but is very specific to the way I am initializing the logging in my application. I have written my own logging handler which writes messages into a JavaFX TextArea. This is done via a Platform.runlater call if the method was not called on the JFX application thread. But in this specific case the logging handler is called so early, that the JFX runtime system is not yet initialized and so the Platform.runlater call never returns. I solved the problem by just delaying the initialization of my JFX logger until JavaFX is properly initialized. Up to now this always worked simply because there were no log messages so early in the process.
13-02-2021

`... in PlatformImpl.startup which never returns.` If it never returns (valid or invalid), it means it is still being executed (probably in a wait or so.) Can you send a threaddump of all running threads? (e.g. ctrl-\)
13-02-2021

So not related to JEP 396. It could be related to the logging, although JavaFX uses the system logger, and doesn't do anything special.
12-02-2021

I tried with AdopOpenJDK 11, Oracle OpenJDK 15, 16, 17 and the failure is consistent on all of these.
12-02-2021

Up to now I can confirm that a simple hello-world JavaFX program still works as expected but all of my larger applications consistently do not. Debugging a little bit into the launch process shows that it is the line Logging.getJavaFXLogger().warning(warningStr); in PlatformImpl.startup which never returns. Maybe there is some problem with Java logging, which I use in my program too.
12-02-2021

What version of the JDK are you using? If you are using JDK 16 then another possible change that could affect you is JEP 396, JDK-8255363.
12-02-2021

The warning is expected after JDK-8256362 was implemented, but there should be otherwise no change in behavior.
12-02-2021

Fixed the version number and will look into more details of the launch configuration.
12-02-2021

I take that you mean JavaFX 16-ea+7? It works fine for me, on MacOS 10.15.6. I'm using the JavaFX Maven plugin, and I only see the warning if use a launcher class and I set <runtimePathOption>CLASSPATH</runtimePathOption>. However the application runs perfectly fine. Also if I launch from my IDE as Java application (no plugin, all in classpath), I see the warning, but the app runs fine. Can you post your steps to reproduce the issue?
12-02-2021