Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274297

HostServices.showDocument should not use java.desktop on Macs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • javafx
    • None
    • macOS 10.14.6
      GraalVM 19.3.1
      client-maven-plugin 0.1.15
      jfx 15-ea+1

    • os_x

      HostServices.showDocument does not work on Mac with the Gluon JavaFX/GraalVM native-image tool chain. It fails with a message saying that
      AWT is currently not supported on Substrate VM. This is due to the fact that, only on the Mac, the HostServicesDelegate calls Desktop.getDesktop().browse to launch a browser. For other platforms Runtime.getRuntime().exec is used. I am wondering why this is not also done for the Mac. The single line Runtime.getRuntime().exec(new String[]{"open", uri}); would do the trick and is even better than, e.g., the current Linux variant which just searches through a list of browser names and picks the first one it finds. This change would fix the problem on Substrate VM and also remove the dependency on java.awt.Desktop. I have tested this on a standard VM as well as with substrate via the client-maven-plugin and it works without problem.

      See discussion on: https://github.com/gluonhq/substrate/issues/337

      Related to: https://bugs.openjdk.java.net/browse/JDK-8170624

            kcr Kevin Rushforth
            mpaus Michael Paus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: