Link to home
Start Free TrialLog in
Avatar of richardsimnett
richardsimnett

asked on

How do I detect if Java is running in a GUI environment or not?

Hello,
I have a program that I would like to run both from the command line as well as via a gui depending on the environment it is being executed in. How do I detect if java was run from a terminal of some sort, or via a gui?

Worth 500 points.

-Rick
Avatar of girionis
girionis
Flag of Greece image

The easiest way is to write this info into a file and then read this file to detect whether the applciation runs from a gui or from command line. Or have a socket that listens to a port and then connect to this port and read the proper information.
ASKER CERTIFIED SOLUTION
Avatar of sciuriware
sciuriware

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sciuriware
sciuriware

:)