<AWT Dev> A simple method to check headless property

Sean Chou zhouyx at linux.vnet.ibm.com
Wed Apr 4 23:21:44 PDT 2012

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:
    Would anyone like to take a look and give some comments ? Thanks.

Best Regards,
Sean Chou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20120405/47f8c304/attachment.html 

More information about the awt-dev mailing list