From 6b7f0d9aa30fa185e04eb693615ffe3b5a9b8cd2 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 22 Jan 2020 15:46:22 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20noJavaFXAlert=20=D0=B8=D0=B7=205.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pro/gravit/launcher/ClientLauncherWrapper.java | 4 ++-- .../src/main/java/pro/gravit/launcher/LauncherEngine.java | 8 ++++++++ .../java/pro/gravit/launcher/gui/JSRuntimeProvider.java | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index aaeba1ec..a8083d7d 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -63,8 +63,6 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) { LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version")); - Collections.addAll(args, "--add-modules"); - Collections.addAll(args, "javafx.base,javafx.fxml,javafx.controls,jdk.unsupported"); Path jvmDir = Paths.get(System.getProperty("java.home")); String pathToFx = System.getenv("PATH_TO_FX"); Path fxPath = pathToFx == null ? null : Paths.get(pathToFx); @@ -79,6 +77,8 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep { Collections.addAll(args, "--module-path"); Collections.addAll(args, modulePath); + Collections.addAll(args, "--add-modules"); + Collections.addAll(args, "javafx.base,javafx.fxml,javafx.controls,jdk.unsupported"); } } Collections.addAll(args, MAGIC_ARG); diff --git a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java index a1556111..94c46024 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java +++ b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java @@ -27,8 +27,16 @@ import pro.gravit.utils.helper.JVMHelper; import pro.gravit.utils.helper.LogHelper; +import javax.swing.*; + public class LauncherEngine { + public static void noJavaFxAlert() { + String message = String.format("Библиотеки JavaFX не найдены. У вас %s(x%d) ОС %s(x%d). Java %s. Установите Java с поддержкой JavaFX, например OracleJRE 8 x%d с официального сайта.\nЕсли вы не можете решить проблему самостоятельно обратитесь к администрации своего проекта", JVMHelper.RUNTIME_MXBEAN.getVmName(), + JVMHelper.JVM_BITS, JVMHelper.OS_TYPE.name, JVMHelper.OS_BITS, JVMHelper.RUNTIME_MXBEAN.getSpecVersion(), JVMHelper.OS_BITS); + JOptionPane.showMessageDialog(null, message, "GravitLauncher", JOptionPane.ERROR_MESSAGE); + } + public static void main(String... args) throws Throwable { JVMHelper.checkStackTrace(LauncherEngine.class); JVMHelper.verifySystemProperties(Launcher.class, true); diff --git a/Launcher/src/main/java/pro/gravit/launcher/gui/JSRuntimeProvider.java b/Launcher/src/main/java/pro/gravit/launcher/gui/JSRuntimeProvider.java index f9ceebbd..34f40bd1 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/gui/JSRuntimeProvider.java +++ b/Launcher/src/main/java/pro/gravit/launcher/gui/JSRuntimeProvider.java @@ -140,6 +140,7 @@ public static void addLauncherClassBindings(Map bindings) { bindings.put("JSApplicationClass", JSApplication.class); } catch (ClassNotFoundException ignored) { LogHelper.warning("JavaFX API isn't available"); + LauncherEngine.noJavaFxAlert(); } }