Hallo,
ich möchte gerne JavaFX nutzen (oder gibt es etwas "besseres" was man aktuell nutzen kann, um eine Grafische Oberfläche zu bauen)
Allerdings bekomme ich folgende fehlermeldung:
Diese Fehlermeldung entsteht sobald ich ein Label hinzufügen will. Ich habe ein Mac und nutze IntelliJ Idea. JDK 11 und die JavaFX Library die ich mir gedownloadet habe. Ich dachte eigentlich funktioniert es nur mit der JDK 11, allerdings klappte das bei mir nicht und deshalb nutze ich die Library von: https://gluonhq.com/products/javafx/.
Ich hoffe mir kann jemand helfen.
Mein Code:
ich möchte gerne JavaFX nutzen (oder gibt es etwas "besseres" was man aktuell nutzen kann, um eine Grafische Oberfläche zu bauen)
Allerdings bekomme ich folgende fehlermeldung:
Code:
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java -Djava.library.path=/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=50279:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Users/maximiliangravemeyer/Library/Mobile Documents/com~apple~CloudDocs/Work/BasicJavaFX/out/production/BasicJavaFX:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/src.zip:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx-swt.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.web.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.base.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.fxml.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.media.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.swing.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.controls.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.graphics.jar" -p /Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.base.jar:/Library/Java/JavaVirtualMachines/javafx-sdk-12/lib/javafx.graphics.jar Main
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.scene.control.ControlHelper (in unnamed module @0x2dafff4f) cannot access class com.sun.javafx.scene.layout.RegionHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.layout to unnamed module @0x2dafff4f
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at javafx.scene.control.Control.<clinit>(Control.java:86)
at Main.start(Main.java:24)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception running application Main
Diese Fehlermeldung entsteht sobald ich ein Label hinzufügen will. Ich habe ein Mac und nutze IntelliJ Idea. JDK 11 und die JavaFX Library die ich mir gedownloadet habe. Ich dachte eigentlich funktioniert es nur mit der JDK 11, allerdings klappte das bei mir nicht und deshalb nutze ich die Library von: https://gluonhq.com/products/javafx/.
Ich hoffe mir kann jemand helfen.
Mein Code:
Code:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("txt to xls converter");
Label label = new Label("Das ist ein Label");
Scene scene = new Scene(label,450,450);
primaryStage.setScene(scene);
primaryStage.show();
}
}