Compiled .jar doesn't load a WebView content JavaFX

249 Views Asked by At

I saw similar problems but any of the solutions doesn't work in my issue. I've got a project structre like this. I try to load a html file map.html to the WebView object by this code:

 try {
        String url = getClass().getResource("/html/map.html").toExternalForm();
        webEngine = webView.getEngine();
        webEngine.setJavaScriptEnabled(true);
        webEngine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
            if (newValue == Worker.State.SUCCEEDED) {
                setFunctionHandlerInHTML(webEngine, "app", this);
                borderPane.setDisable(false);
            }
        });
        webEngine.load(url);

I don't understand where the problem is couse i try to fallow instructions included in this post JavaFX resource handling: Load HTML files in WebView but is still doesn't work.

Thanks a lot !!

0

There are 0 best solutions below