oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀

Home Page:https://www.graalvm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Desktop.getDesktop().browse() not working in native application

38leinaD opened this issue · comments

The following gives me an error when running within a native image:

Desktop.getDesktop().browse(new URI("http://www.google.com"));
Under GraalVM 20.0.0 i am getting:

2020-05-03 09:07:45,447 ERROR [io.qua.run.Application] (main) Error running Quarkus application: java.awt.HeadlessException
	at java.awt.Desktop.getDesktop(Desktop.java:301)
	at org.acme.LsMain.run(LsMain.java:45)
	at org.acme.LsMain_ClientProxy.run(LsMain_ClientProxy.zig:42)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:30)

Under GraalVM 19.3.1 i am getting an additional output:

2020-05-03 07:17:47,090 ERROR [io.qua.run.Application] (main) Error running Quarkus application: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
	at java.awt.Desktop.getDesktop(Desktop.java:301)
	at org.acme.LsMain.run(LsMain.java:45)
	at org.acme.LsMain_ClientProxy.run(LsMain_ClientProxy.zig:42)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:30)

But if i do echo $DISPLAY, it shows me that the variable is correctly set (":1") within the shell and also xclock works.

When running as a regular java application with GraalVM "java", browser window is opened without problem.

What is the expectation. Should this work? I would understand that these Desktop APIs might not work on all platforms, but as it is working in normal JVM-mode, should this also work from a native image?

Describe GraalVM and your environment:

 openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
  • OS: Debian GNU/Linux 9.12 (stretch) / Gnome
  • Architecture: AMD64

This should be fixed by now.