static Boolean isHeadless_cache; static bool isHeadless() { if (isHeadless_cache != null) ret isHeadless_cache; if (isAndroid()) ret isHeadless_cache = true; if (GraphicsEnvironment.isHeadless()) ret isHeadless_cache = true; // Also check if AWT actually works. // If DISPLAY variable is set but no X server up, this will notice. try { SwingUtilities.isEventDispatchThread(); ret isHeadless_cache = false; } catch (Throwable e) { ret isHeadless_cache = true; } }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1004381 |
Snippet name: | isHeadless - "headless" graphics environment (no display)? |
Eternal ID of this version: | #1004381/3 |
Text MD5: | 62eea8c9f87beb0836258e0653c95257 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-04 17:53:11 |
Source code size: | 505 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 614 / 804 |
Version history: | 2 change(s) |
Referenced in: | #1004670 - isAWT - do we have a windowing system running? #1006654 - Standard functions list 2 (LIVE, continuation of #761) |