3

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);
    }

}
alam33
  • 63
  • 8
  • 1
    You should report this as a bug here: https://bugs.java.com/bugdatabase/ – mipa Jun 10 '19 at 08:03
  • Yes, I did and it was just now accepted by Oracle. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8225502 – alam33 Jun 10 '19 at 08:25
  • Oracle has closed the bug claiming it is not reproducible. However I can reproduce on two separate machines. My guess is that I am probably using Windows 'classic' desktop and some other personalizations of Windows which triggers the hang. – alam33 Jun 11 '19 at 20:45
  • I asked Oracle to take a look again, providing them with the stackdump, and this time they asked me to try a vm option, which solves the problem (although they were not able to reproduce it on their side). I suspect this is a very hardware specific issue, but at least we have a workaround now. Add the following option to the VM if you have this issue. -Dprism.order=sw – alam33 Jun 13 '19 at 20:26

1 Answers1

2

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.

alam33
  • 63
  • 8
  • Well, I would not call this a workaround. It just switches off all graphics hardware accelleration which makes the whole thing only usable for trivial rendering tasks. I assume this was just an attempt to make sure this is a hardware rendering issue. – mipa Jun 13 '19 at 23:14
  • You are probably right, I don't know much about low level hardware. I am hoping Oracle will fix it properly later. – alam33 Jun 14 '19 at 20:31