[FIX] Фикс ошибки JavaFX при запуске на Java 9+ без openjfx

This commit is contained in:
Gravit 2020-01-04 21:54:17 +07:00
parent 7d5b912c3c
commit 1ae7c80c72
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -63,8 +63,6 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
JVMHelper.addSystemPropertyToArgs(args, DirWatcher.IGN_OVERFLOW); JVMHelper.addSystemPropertyToArgs(args, DirWatcher.IGN_OVERFLOW);
if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) { if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) {
LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version")); LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version"));
args.add("--add-modules");
args.add("javafx.base,javafx.fxml,javafx.controls,jdk.unsupported");
Path jvmDir = Paths.get(System.getProperty("java.home")); Path jvmDir = Paths.get(System.getProperty("java.home"));
String pathToFx = System.getenv("PATH_TO_FX"); String pathToFx = System.getenv("PATH_TO_FX");
Path fxPath = pathToFx == null ? null : Paths.get(pathToFx); Path fxPath = pathToFx == null ? null : Paths.get(pathToFx);
@ -76,6 +74,8 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
tryAddModule(findPath, "javafx.controls", builder); tryAddModule(findPath, "javafx.controls", builder);
String modulePath = builder.toString(); String modulePath = builder.toString();
if (!modulePath.isEmpty()) { if (!modulePath.isEmpty()) {
args.add("--add-modules");
args.add("javafx.base,javafx.fxml,javafx.controls,jdk.unsupported");
args.add("--module-path"); args.add("--module-path");
args.add(modulePath); args.add(modulePath);
} }