How can you detect whether Java System.out is a terminal? [duplicate]
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.
精彩评论