HeadlessException in JavaFX on MacOS X with OpenJDK 10 and OpenJFX

Viewed 331

I'm getting the error

java.awt.HeadlessException: null
    at java.desktop/java.awt.Desktop.getDesktop(Desktop.java:306) ~[na:na]

when calling

Desktop.getDesktop().open(pdfFile);

I am using OpenJDK with this version

java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

and OpenJFX in javafx-sdk-11 on MacOS 10.14.2.

Why is the JVM run in headless mode here on MacOS? How can I run it without headless mode?

1 Answers
Related