Can anyone explain to me where the mistake is?
For several days I have been trying to clarify this issue:
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- Non-modular from IDE
- create a JavaFX project
- Attach the Library
- in the VM Option field : --module-path "C:\opt\javafx-sdk-15.0.1\lib" --add-modules javafx.fxml, javafx.controls
= result: Error: JavaFX runtime components are missing, and are required to run this applicatio
2)**modular from IDE **
- create a file: module-info.java
requires javafx.controls;
requires javafx.fxml;
opens sample;
Result: run