Trying to load a local page into JavaFX webEngine

You could use the file syntax for the URI e.g.

file:///C:/path/to/file.html (Windows)

https://en.wikipedia.org/wiki/File_URI_scheme


You need to read the local file in as a URL so that the WebEngine can find it. For instance, you can find the file as a resouce using

URL url = this.getClass().getResource("/com/cds/gui/webView/main.html");
webEngine.load(url.toString());

Or you can load the actual String path into a File object and use it to get the String URL.

File f = new File("full\\path\\to\\webView\\main.html");
webEngine.load(f.toURI().toString());

Hope this helps!