RFR: 8364687: Enable headless with -Dglass.platform=headless [v2]

Johan Vos jvos at openjdk.org
Mon Aug 11 12:11:21 UTC 2025


On Tue, 5 Aug 2025 11:45:50 GMT, Clément de Tastes <duke 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.
>
> Clément de Tastes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove additional space

Both your original code as the patch you mention above work. I'm unsure what is the best (most elegant and most consistent approach).

The code in `com.sun.glass.ui.Platform` first checks if the property *"glass.platform"* is set, and only if that is not set, there is a fallback to `PlatformUtil`. 

`PlatformUtil` relies mainly on the value of the System Property *"os.name"*. 

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?

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?

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

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


More information about the openjfx-dev mailing list