JavaFX Freeze on Desktop.open(file), Desktop.browse(uri)

后端 未结 5 746
滥情空心
滥情空心 2020-12-09 16:13

I\'m running some code in Java on Ubuntu 12.04 LTS 64 Bit (with Gnome Shell), using Oracle JDK 1.8.0_05 via NetBeans8.0.

The following function works perfectly when

5条回答
  •  没有蜡笔的小新
    2020-12-09 16:50

    I also have this same problem. I found out that if I call the Desktop.open() method from a new thread, the file will open after I close the JavaFX application window, but that doesn't help much.

    If you put

    SwingUtilities.invokeLater(() -> System.out.println("Hello world"));
    

    in to your main method after your launch(args) call, it also won't get called until after you close the JavaFX application.

    It seems like there's some kind of concurrency issue between the JavaFX application and Swing.

    On Ubuntu you can try

    xdg-open filename
    

    from your JavaFX app.

    As far as I can tell, your code should work.

提交回复
热议问题