ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: how to run java.exe in the different process (not thread) respectively?
Date Tue, 20 Aug 2002 09:39:49 GMT
suogen wrote:
> Conor,
> 
> Thanks for your suggestion!
> 
> 
> my build.xml as follow:
> 
> <target name="runserver" depends="compile">
>      <java classname="MyServer" fork="yes" failonerror="true">
>       </java>
>  </target>
> 
>  <target name="runclient" depends="compile">
>      <java classname="MyClient" fork="yes" failonerror="true">
>       </java>
>  </target>
> 
> <target name="runall" depends="runserver, runclient" />
> 
> when the server has start, it will block untill the client to connect to it.
> so when i run "runall" target,
> it will be blocked, the client will not run. i want the client and server
> can run in different process (like
> in console to run start ...), how can i achieve it in the ant?
> 

OK, your original use of <parallel> will work. It will create two threads. 
Each of these threads will create a new process (because of the fork="yes") 
and then block until that process terminates.

If you want to use separate consoles, you probably need to use the <exec> 
task to start an OS level script which launches java in a separate window.

Alternatively you can set the taskname

<java taskname="client" ...>

<java taskname="server" ...>

When you do this, output will appear with

[client]
and
[server]

allowing you to differentiate between the two processes/threads. Thats what 
I do (I run several weblogic instances and a junit test task in one go).

Conor





--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message