I'm new to javaFX and I'm trying to run a simple app. it's UI is created with javaFX scenebuilder and the Main class is supposed to display the UI, nothin else.
public class Main extends Application {
public static void main(String[] args) {
launch(Main.class, (String[])null);
}
@Override
public void start(Stage primaryStage) {;
try {
AnchorPane root=(AnchorPane)FXMLLoader.load(Main.class.getResource("Main.fxml"));
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.setTitle("Issue Tracking Lite Sample");
primaryStage.show();
} catch (IOException e) {System.err.println(e);}
}
}
I got this error when running the app:
No resources specified.
/D:/workspace/FileSharing_ServerSide/bin/com/Shayan/FileSharing/Server/Main.fxml:16
at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:305)
at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:197)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:588)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2430)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
javafx.fxml.LoadException: No resources specified.
It says that the file doesn't exists, but it exists in that folder with the exact same name! it's in the same package as the code is. anybody knows what's going on?! thanks in advance
JavaFX throws the exception javafx.fxml.LoadException: No resources specified.
when the FXMLLoader could not fully build the scene graph because of a missing resource.
This could happen for a variety reasons. I've encountered it because of the following:
ResourceBundle
but the FXMLLoader
did not have the ResourceBundle
properly configured.There may be other reasons why this exception is thrown from within JavaFX, but the root cause is that for some reason or another, the FXMLLoader encountered an exception while trying to create the scene graph from the fxml file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With