'JavaFx error in Exception in Application start method on FXMLLoader

package application;
import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class Main extends Application {
    public static void main(String[] args) { 
        launch(args);
    }
    @Override
    public void start(Stage stage) throws Exception {
        BorderPane root;
        try {
            FXMLLoader loader = new 
FXMLLoader(getClass().getResource("Mainview.fxml"));
            loader.setController(this);
            root = loader.load();
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        }catch(IOException e) {
            e.printStackTrace();
        }
    }
}

import FXMLLoader -> Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.Because of this part of the application It's still a run exception, but I'm curious about the solution.



Solution 1:[1]

You should update the module-info.java. You must also open the project to JavaFX in order it for it to run.

Here is an example

In your case, write:

opens [the name of your package] to javafx.fxml;
exports [the name of your package];

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elikill58