@FXML
void openCaptchaSolver(MouseEvent event) {
Stage primaryStage = (Stage)((Node)event.getSource()).getScene().getWindow();
Stage secondaryStage = new Stage();
WebView web = new WebView();
WebEngine engine = web.getEngine();
engine.load("https://www.google.com");
VBox root = new VBox();
root.getChildren().addAll(web);
secondaryStage.setScene(new Scene(root, 500, 575));
secondaryStage.setTitle("Secondary Stage");
secondaryStage.show();
}
I'm trying to get started with WebView's in JavaFX but when trying to open one I'm receiving the errors shown below, how would I go about fixing this issue?
Caused by: java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.sg.prism.web.NGWebView (in unnamed module @0x6b0c2d26) cannot access class com.sun.javafx.sg.prism.NGGroup (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module @0x6b0c2d26
When getting any errors trying to run WebView make sure your VM options contain the module javafx.web.
VM Options: --module-path C:\path\to\javafx\openjfx-13.0.1_windows-x64_bin-sdk\javafx-sdk-13.0.1\lib --add-modules javafx.controls,javafx.fxml,javafx.web
In IntelliJ you can access the VM options by going to the "Edit Configurations" button in the top right of the IDE