Skip to content

Commit f59ee5a

Browse files
Christopher Schnickaivanov-jdk
authored andcommitted
8248122: java launcher should launch normally if JavaFX modules not found
Reviewed-by: kcr, prr, aivanov
1 parent 9be6e77 commit f59ee5a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/java.base/share/classes/sun/launcher/LauncherHelper.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ private LauncherHelper() {}
9898
"javafx.application.Application";
9999
private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
100100
"sun.launcher.LauncherHelper$FXHelper";
101+
private static final String JAVAFX_GRAPHICS_MODULE_NAME =
102+
"javafx.graphics";
101103
private static final String LAUNCHER_AGENT_CLASS = "Launcher-Agent-Class";
102104
private static final String MAIN_CLASS = "Main-Class";
103105
private static final String ADD_EXPORTS = "Add-Exports";
@@ -768,8 +770,9 @@ public static Class<?> checkAndLoadMain(boolean printToStderr,
768770
* the main class may or may not have a main method, so do this before
769771
* validating the main class.
770772
*/
771-
if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
772-
doesExtendFXApplication(mainClass)) {
773+
if ((JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
774+
doesExtendFXApplication(mainClass)) &&
775+
ModuleLayer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME).isPresent()) {
773776
// Will abort() if there are problems with FX runtime
774777
FXHelper.setFXLaunchParameters(what, mode);
775778
mainClass = FXHelper.class;
@@ -1082,9 +1085,6 @@ public String toString() {
10821085

10831086
static final class FXHelper {
10841087

1085-
private static final String JAVAFX_GRAPHICS_MODULE_NAME =
1086-
"javafx.graphics";
1087-
10881088
private static final String JAVAFX_LAUNCHER_CLASS_NAME =
10891089
"com.sun.javafx.application.LauncherImpl";
10901090

0 commit comments

Comments
 (0)