<AWT Dev> A simple method to check headless property

Artem Ananiev artem.ananiev at oracle.com
Fri Apr 6 03:41:56 PDT 2012


Hi, Sean,

your assumption about "Windows vs everything else" is not quite correct. 
Mac OS X is now officially supported platforms, and we don't want to 
fall into the headless mode on that platform if DISPLAY is unset, right?

Thanks,

Artem

On 4/5/2012 10:21 AM, Sean Chou wrote:
> Hi all,
>
>      I thought the code to check headless property
> in src/share/classes/java/awt/GraphicsEnvironment.java is a
> little redundant, it checks every platform one by one.
> "headless = defaultHeadless =
>        Boolean.valueOf(("Linux".equals(osName) ||
> "SunOS".equals(osName) ||
> "FreeBSD".equals(osName) ||
> "NetBSD".equals(osName) ||
> "OpenBSD".equals(osName)) &&
>                                 (System.getenv("DISPLAY") == null));
> "
>
>      As java is used on more platforms than officially supported by
> openjdk, and so far we can see the only excluded platform is windows. If
> this piece of code can be changed to exclude window only, it would be
> simpler to port.
>
>      I made a webrev for it:
> http://cr.openjdk.java.net/~zhouyx/OJDK-158/webrev.00/
>      Would anyone like to take a look and give some comments ? Thanks.
>
> --
> Best Regards,
> Sean Chou
>



More information about the awt-dev mailing list