JavaFX XML Versuch

O2016

Bekanntes Mitglied
Hallo,

versuche mich gerade an JavaFX mit XML. Habe eine Exception in der start Methode.
Ich vermute, da er die fxml_example.fxml nicht findet.

Ich bin mir unsicher wie ich das angeben muss. Folgender Aufbau besteht bei mir:

Projektname: JavaFX XML -> src -> application ->( Javadateien und fxml_example.fxml)

So klappt es bei mir nicht und ohne das application auch nicht:
Java:
 Parent root = FXMLLoader.load(getClass().getResource("application/fxml_example.fxml"));
[/Java]
 
Fehlermeldung:

Java:
Exception in Application start method
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
   at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
   at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Location is required.
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
   at application.FXMLExample.start(FXMLExample.java:16)
 

Neue Themen


Zurück
Oben