<分区>
Possible Duplicate:
How can I check if a Java program's input/output streams are connected to a terminal?
我希望能够让一个问题在以交互方式运行时与以自动方式运行时表现不同。在 Python 中,您可以使用 sys.stdout.isatty
来检测这一点(参见 this question )。 Java 中有等效项吗?
<分区>
Possible Duplicate:
How can I check if a Java program's input/output streams are connected to a terminal?
我希望能够让一个问题在以交互方式运行时与以自动方式运行时表现不同。在 Python 中,您可以使用 sys.stdout.isatty
来检测这一点(参见 this question )。 Java 中有等效项吗?
最佳答案
一个选项是使用自动方式在命令行上定义系统属性。例如:-Dcom.xyz.automated=true.
关于java - 如何检测 Java System.out 是否是终端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6309848/