The application in the listing below never finishes, i.e. the loading of the web page never reaches the SUCCEEDED state (or any other state after RUNNING). The output is always:
SCHEDULED
RUNNING
code:
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Worker;
import javafx.scene.web.WebEngine;
import javafx.stage.Stage;
public class WebEngineIssue extends Application {
private static final String JAVA_API = "http://docs.oracle.com/javase/8/docs/api/";
@Override
public void start(final Stage stage) {
WebEngine engine = new WebEngine();
engine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
System.out.println(newState);
if (newState == Worker.State.SUCCEEDED) {
Platform.exit();
}
});
engine.load(JAVA_API);
}
}
SCHEDULED
RUNNING
code:
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Worker;
import javafx.scene.web.WebEngine;
import javafx.stage.Stage;
public class WebEngineIssue extends Application {
private static final String JAVA_API = "http://docs.oracle.com/javase/8/docs/api/";
@Override
public void start(final Stage stage) {
WebEngine engine = new WebEngine();
engine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
System.out.println(newState);
if (newState == Worker.State.SUCCEEDED) {
Platform.exit();
}
});
engine.load(JAVA_API);
}
}
- relates to
-
JDK-8088550 Simple WebEngine application is undeterministic (works/works very slowly/hangs/throws exception)
-
- Open
-