开发者

How can you detect whether Java System.out is a terminal? [duplicate]

This question already has answ开发者_如何转开发ers here: Closed 11 years ago.

Possible Duplicate:

How can I check if a Java program's input/output streams are connected to a terminal?

I'd like to be able to have a problem behave differently when being run interactively versus in an automated way. In Python, you can use sys.stdout.isatty to detect this (see this question). Is there an equivalent in Java?


One option is for the automated way to define a system property on the command line. For example: -Dcom.xyz.automated=true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜