I have the code:
package core;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
You have not set a resources folder in your project structure in order the getResourse
method to work.
Since you don't have the common Java structure, try providing the full path instead:
FXMLLoader loader = new FXMLLoader(new File("fullpath").toURI().toURL());
Parent root = loader.load();
And if you want your code to work, you should be having a structure like the following, where main.fxml
is inside resources directory:
You can set a folder as "Resources folder" here: Project Structure->Modules->Sources