Harold L. Brown
Harold L. Brown

Reputation: 9966

HeadlessException in JavaFX on MacOS X with OpenJDK 10 and OpenJFX

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?

Upvotes: 3

Views: 488

Answers (1)

Harold L. Brown
Harold L. Brown

Reputation: 9966

The problem was not caused by OpenJDK, OpenJFX or MacOS X, but by Spring Boot.

Per default Spring Boot applications are run in headless mode. Here's how this can be disabled:

Upvotes: 5

Related Questions