[FIX] noJavaFXAlert из 5.1.0

This commit is contained in:
Gravit 2020-01-22 15:46:22 +07:00
parent 29fffae33b
commit 6b7f0d9aa3
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 11 additions and 2 deletions

View file

@ -63,8 +63,6 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
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"));
Collections.addAll(args, "--add-modules");
Collections.addAll(args, "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);
@ -79,6 +77,8 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
{ {
Collections.addAll(args, "--module-path"); Collections.addAll(args, "--module-path");
Collections.addAll(args, modulePath); 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); Collections.addAll(args, MAGIC_ARG);

View file

@ -27,8 +27,16 @@
import pro.gravit.utils.helper.JVMHelper; import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
import javax.swing.*;
public class LauncherEngine { 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 { public static void main(String... args) throws Throwable {
JVMHelper.checkStackTrace(LauncherEngine.class); JVMHelper.checkStackTrace(LauncherEngine.class);
JVMHelper.verifySystemProperties(Launcher.class, true); JVMHelper.verifySystemProperties(Launcher.class, true);

View file

@ -140,6 +140,7 @@ public static void addLauncherClassBindings(Map<String, Object> bindings) {
bindings.put("JSApplicationClass", JSApplication.class); bindings.put("JSApplicationClass", JSApplication.class);
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
LogHelper.warning("JavaFX API isn't available"); LogHelper.warning("JavaFX API isn't available");
LauncherEngine.noJavaFxAlert();
} }
} }