ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: Stdout of Java.execute() without going through a file?
Date Sun, 15 Aug 2004 21:17:01 GMT
> From: Vincent Massol []
> I'm using the Ant Java task to start J2EE containers. However, in
order to
> know if they are started I'd like to read the stdout produced by these
> containers. Now there are 2 solutions I know of:
> - using java.setOutputProperty(). The problem is that the property is
> set when the execute() command returns which doesn't work for several
> containers that do not return (Orion for example).
> - using java.setOutput(File). However this goes to a file and I'd
> not
> use it for 2 reasons: I'd rather not have to output to a file as I may
> always have a handy location for that file (I'd rather not use tmp dir
> either) + I'd like to make the file output optional, decided by the
> My question: Is there a way I can use to monitor the stdout content
> resulting from the execution of execute() without going through a

Seems like you are doing this in code, rather than in XML, but in either
case there is a third solution that uses <record> or its underlying
mechanism, BuildListerners. With <record>, you'd be forced to go thru a
file still, but by implementing your own listener like Record does, and
installing it prior to Java.execute(), you can monitor the messages and
do what you asked about it would seem. You can then uninstall the
listener when you've detected the message you expected, or after
Java.execute complete (or throws) in case the startup of the J2EE server

Not sure if this applies to what you had in mind without more details,
but hopefully that helps. A+, --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message