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
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
- duplicates
-
JDK-8214158 Implement HostServices.showDocument on macOS without calling AWT
-
- Resolved
-