Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostServices.showDocument does not work on Mac #337

Closed
mipastgt opened this issue Feb 12, 2020 · 2 comments
Closed

HostServices.showDocument does not work on Mac #337

mipastgt opened this issue Feb 12, 2020 · 2 comments
Labels

Comments

@mipastgt
Copy link

HostServices.showDocument does not work on Mac. 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.

macOS 10.14.6
GraalVM 19.3.1
client-maven-plugin 0.1.15
jfx 15-ea+1

@johanvos johanvos added the mac label Feb 14, 2020
@jperedadnr
Copy link
Contributor

jperedadnr commented Sep 23, 2021

Sorry for the late reply. Indeed it is weird that OpenJFX uses java.desktop only for Mac, and Runtime for the other platforms. This should be filed as a JBS issue that modifies the change that was done for https://bugs.openjdk.java.net/browse/JDK-8170624.
In the meantime, BrowserService in Attach 4.0.13 has now the implementation for desktop
https://github.com/gluonhq/attach/blob/master/modules/browser/src/main/java/com/gluonhq/attach/browser/impl/DesktopBrowserService.java
and this can be used on Mac instead of HostServices.

@mipastgt
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants