Ant redirecting stdout to a file while in a spawned java program

D

Douwe

Hi,

I created a build.xml file that starts a spawned java application. The
program starts fine and the ant terminates nicely as expected.
Unfortunately this program can (just like any other program) produce
errors on the console and Ant does not allow you to redirect the
standard output (stdout) while spawning a proces.

I´ve browsed the Ant source code and ended read the Java API of the
Process class (since this is indirectly called by the ant task <java>.
This API reports that the process knows three methods called:
Process.getOutputStream(), Process.getInputStream(),
Process.getErrorStream().

Is their somehow a workaround to set the stdout in a new process
without altering my program?

Thnx
 
M

Mike Schilling

Douwe said:
Hi,

I created a build.xml file that starts a spawned java application. The
program starts fine and the ant terminates nicely as expected.
Unfortunately this program can (just like any other program) produce
errors on the console and Ant does not allow you to redirect the
standard output (stdout) while spawning a proces.

Yes, it does. Look at the error and output argument to the java task.

http://ant.apache.org/manual/CoreTasks/java.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top