1 | static Boolean isHeadless_cache; |
2 | |
3 | static bool isHeadless() { |
4 | if (isHeadless_cache != null) ret isHeadless_cache; |
5 | if (isAndroid()) ret isHeadless_cache = true; |
6 | if (GraphicsEnvironment.isHeadless()) ret isHeadless_cache = true; |
7 | |
8 | // Also check if AWT actually works. |
9 | // If DISPLAY variable is set but no X server up, this will notice. |
10 | |
11 | try { |
12 | SwingUtilities.isEventDispatchThread(); |
13 | ret isHeadless_cache = false; |
14 | } catch (Throwable e) { ret isHeadless_cache = true; } |
15 | } |
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: | 613 / 804 |
Version history: | 2 change(s) |
Referenced in: | [show references] |