Javadoc for this method claims:
Returns a unique console object associated with the current Java virtual machine, if any.
And the docs for the System.Console class state:
Whether the virtual machine is a console depends on the underlying platform, as well as on how the virtual machine is called. If the virtual machine is started from the interactive command line without redirecting standard input and output streams, then its console will exist and, as a rule, will be connected to the keyboard and display from which the virtual machine was started. If the virtual machine starts automatically, for example, using the background task scheduler, then usually there will be no console.
I would suggest that when Ant opens a new Java process, it redirects standard output.
source share