Detecting launch method/operating environment?
Posted on 2009-06-30
Just wondering how to detect the method used to launch a java application (not applet) -- or just a way to detect if I'm running in a GUI or terminal environment.
basically if it's launched from the GUI, i want to display the GUI
if the app is launched from the command line/terminal i want to run in terminal mode if no flags are passed "myApp", or launch the GUI if a flag is passed "myApp -gui"
so far the only real solution i've found would be to use the args array and check to see if the user specifies that they want to run it from the command line .... from the command line "maApp -terminal" ... i consider this solution, at most, a hack around my ignorance and would prefer something a little more passive / auto-magical if possible.