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?

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 2020-12-28 22:35 +0000
Organization A noiseless patient Spider
Message-ID <slrnruknd0.2g1.avl@logic.at> (permalink)
References <rsdjk5$200$1@dont-email.me>

Show all headers | 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