On Sat, 2 May 2026 02:40:05 GMT, Christopher Schnick <[email protected]> 
wrote:

> This PR allows Main classes to be launched if they extend the Application 
> class, even when only having the JavaFX dependencies on the classpath instead 
> of the module path. This issue has been there for a long time and was quite 
> annoying for a lot of people: 
> https://stackoverflow.com/questions/78501081/how-do-i-fix-error-javafx-runtime-components-are-missing-and-are-required-to-r.
>  It is also a common use case for JavaFX developers when testing some PR to 
> create a quick reproducer class without setting up the module path properly.
> 
> While it is true that launching modern JavaFX via the classpath is 
> unuspported, it still launches and prints its own warnings, which is better 
> than the previous behavior. The old launcher error message in this case is 
> misleading as the runtime components aren't really missing, they are just not 
> in the module path.
> 
> This change should not have any change in behavior for any other case.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Someone from core-libs who is familiar with the Java launcher should review 
this. I also plan to review and test this.

I'm going to add the `client` label to cross-post the review there. In addition 
to some folks on that list being interested, we need to ensure that there is no 
impact to Swing / JavaFX interop (I very much doubt that there will be, but I 
want to double-check).

Have you run tier1 and tier2 tests to ensure no regressions?

I changed the title to match the actual problem being addressed (the original 
title described expected behavior, so was not suitable).

You will need to change the title to match.

src/java.base/share/classes/sun/launcher/LauncherHelper.java line 1131:

> 1129:             // this method is only called if we can find the module
> 1130:             // in the first place, so it will always be present
> 1131:             Module om = 
> ModuleLayer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME).orElseThrow();

Even though this will now never be called unless 
`findModule(JAVAFX_GRAPHICS_MODULE_NAME)` is present, it seems cleaner and less 
intrusive to revert the changes in this method.

-------------

PR Review: https://git.openjdk.org/jdk/pull/31016#pullrequestreview-4223056963
PR Review Comment: https://git.openjdk.org/jdk/pull/31016#discussion_r3184135106

Reply via email to