RFR: 8364687: Enable headless with -Dglass.platform=headless

Kevin Rushforth kcr at openjdk.org
Mon Aug 11 20:53:18 UTC 2025


On Tue, 5 Aug 2025 11:39:52 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Basically allow -Dglass.platform=headless to enable headless, not only -Dglass.platform=Headless.
>> This makes it consistent with other options (macosx, windows, linux, gtk and ios) as well was less error-prone for enabling it.
>
> Reviewer: @johanvos

> But I believe there is an inconsistency in `PlatformUtil`. Some of the code uses the "glass.platform" as well, and I think that goes against the idea that "glass.platform" is glass-specific, where glass is part of the `javafx.graphics` module, hence it should be used in the `javafx.graphics` module, and _not_ in the `javafx.base` module. That would require a major refactory, where the overlap between the javafx.base `PlafformUtil` and the javafx.graphics `Platform` is removed. @kevinrushforth Do you have any thoughts about this?

Yes it does seems a bit odd for something in `javafx.base` to use a system property that conceptually belongs to `javafx.graphics`. For that matter, methods like `useEGL`,  `isEmbedded`, and `isHeadless` really don't belong in `javafx.base`. I checked and there are no references to `PlatformUtil` in `javafx.base` at all. Perhaps the whole class should move to `javafx.graphics` along with addressing the issue of having two inconsistent ways to do the same thing? That might be a reasonable clean-up bug for the future.

> Since the current proposed PR is simple and useful (using `headless` instead of `Headless` should work indeed), I am ok with this PR, unless there is an easy solution that provides more consistency?

I also think the current patch as it stands is good (and better than the second alternative).

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1864#issuecomment-3176849873


More information about the openjfx-dev mailing list