So I have downloaded JavaFX SDK, I'm working with IntelliJ Idea editor. I set it in the system and user environment variables path: C:\Program Files\Java\javafx-sdk-17.0.2\lib
This is the code I am trying to work with:
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(" ");
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
I put this into Virtual Machine options which are located Run -> Edit Configurations: --module-path %PATH_TO_FX% --add-modules=javafx.controls
. But I'm still getting the following error: java.lang.module.FindException: Module javafx.controls not found.
This is a Project Structure:
This is using a path of a library: