After updating Windows to 1903 (May 2019) JavaFX fails to create stage

Viewed 252

I updated my Windows 10 laptop with May 2019 build (1903) and JavaFX does not seem to work anymore. After launching any JavaFX application, I see an icon on the taskbar, but no window is created. My java is the latest Java 8, latest Eclipse as IDE.

Is this a known issue or am I doing something wrong? Is there are a work-around or fix? Thanks

I have created a small app that reproduces the problem. If I comment out the following line primaryStage.initStyle(StageStyle.UNDECORATED); then it works as expected. Otherwise Windows 10 (1903) hangs, no window is shown. Be warned that you will need to use task-manager in windows to kill the JVM.

package com.alam33;

import java.io.IOException;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class Win10_1903Test extends Application {

    public Win10_1903Test() {

    }

    @Override
    public void start(Stage primaryStage) throws IOException {

        VBox vbox = new VBox();
        vbox.setPrefHeight(200);
        vbox.setPrefWidth(300);
        Scene scene = new Scene(vbox);
        primaryStage.setTitle("Win10_1903Test");
        primaryStage.setScene(scene);
        primaryStage.setFullScreen(true);

        /* THIS IS THE OFFENDING LINE */
        primaryStage.initStyle(StageStyle.UNDECORATED);

        primaryStage.show();

    }

    public static void main(String[] args) {

        launch(args);
    }

}
1 Answers

This is a workaround provided by Oracle, although they could not reproduce it. I suspect the problem is specific to the hardware in my machines.

Workaround: add jvm option -Dprism.order=sw

As noted below, it is not a proper solution but I take it as an answer because it does help to make sure that your code is OK, which is important during development.

Related