can not resolve symbol “javafx.scene.web”

This is one way to do it:

  1. Create a new JavaFX project.
  2. Edit pom.xml.
  3. Add a dependency on javafx-web.
    • Use the same version as the rest of the JavaFX dependencies in that file.
    • Hit the refresh icon in the maven window to re-synchronize the Maven project with the IDE project.
  4. Edit module-info.java.
  5. Add the line requires javafx.web;.

You will now be able to use WebView in your code.

Alternatively, take your existing project, follow the advice in the answer kleopatra linked:

and add in the javafx.web module where-ever that answer refers to adding modules.

The answer is similar to the following which discusses the javafx.media module:

I advise using the most recent stable version of Java and JavaFX for development, currently 17.0.2, not JavaFX 11, especially if you have an M1 Mac. Only JavaFX 17.0.2+ works with M1 Macs.

Leave a Comment