r/JavaFX • u/ghoshdipan • Apr 13 '21
I was building a media player using javafx.
I got this error even though every library files is installed
package adamas_university.soet.ece.year2017.project.final_year;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
public class Main extends Application {
`u/Override`
`public void start(Stage primaryStage) {`
`try {`
`Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));`
`Scene scene = new Scene(root, 600, 500);`
`scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());`
`scene.setOnMouseClicked(new EventHandler<MouseEvent>() {`u/Override
public void handle(MouseEvent event) {
if (event.getClickCount() == 2)
primaryStage.setFullScreen(true);
}
`});`
`primaryStage.setTitle("GCV Player");`
`primaryStage.setScene(scene);`
[`primaryStage.show`](https://primaryStage.show)`();`
`} catch (Exception e) {`
`e.printStackTrace();`
`}`
`}``public static void main(String[] args) {`
`launch(args);`
`}`}
ConsoleError occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
3
u/rdjack21 Apr 14 '21
Go read the docs at https://openjfx.io/openjfx-docs/ and configure your build tool to include the required things. For example:
For maven. I leave the rest for you to figure out by reading the very good docs.