How to detect if a graphical interface is supported?

前端 未结 5 756
悲哀的现实
悲哀的现实 2021-01-01 12:20

I need my Java program to have two display modes: a GUI interface and a command line interface. If I run it in Windows, OS X, or another graphical environment I should get

5条回答
  •  自闭症患者
    2021-01-01 12:38

    I recommend adding a command line option that determines whether to use command-line or graphical user interface, because the user may want to use the command-line interface even in the environment where GUI is available.

    You can also check if console device is available or not with System.console().

提交回复
热议问题