Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39652

Re: Any way to tell on linux if program is started from a terminal?

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Andreas Leitgeb <avl@logic.at>
Newsgroups comp.lang.java.programmer
Subject Re: Any way to tell on linux if program is started from a terminal?
Date Mon, 28 Dec 2020 22:35:12 -0000 (UTC)
Organization A noiseless patient Spider
Lines 13
Message-ID <slrnruknd0.2g1.avl@logic.at> (permalink)
References <rsdjk5$200$1@dont-email.me>
Reply-To avl@logic.at
Injection-Date Mon, 28 Dec 2020 22:35:12 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="9eee68d0b60590c4d76485fba41779ac"; logging-data="23111"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QruZrzspPpaJD60kWKjG+"
User-Agent slrn/1.0.3 (Linux)
Cancel-Lock sha1:iWJsmapKO7r1ZovwoTxmK10vyQM=
Xref csiph.com comp.lang.java.programmer:39652

Show key headers only | View raw


Knute Johnson <knute2020@585ranch.com> wrote:
> Any way to tell on linux if a program is started from a terminal versus 
> started from clicking on an icon?

Maybe
https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/GraphicsEnvironment.html#isHeadless()

or
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#console()
(compare result with null)

depending on what you want to get if both console and X11 is available.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Any way to tell on linux if program is started from a terminal? Knute Johnson <knute2020@585ranch.com> - 2020-12-28 15:44 -0600
  Re: Any way to tell on linux if program is started from a terminal? Andreas Leitgeb <avl@logic.at> - 2020-12-28 22:35 +0000
    Re: Any way to tell on linux if program is started from a terminal? Knute Johnson <knute2020@585ranch.com> - 2020-12-28 20:07 -0600

csiph-web