You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by tek1 <te...@pobox.com> on 2002/04/10 04:57:43 UTC

forking new jvm in ExecuteJava?

hello.

i've written a custom task that make a call to a third-party java .class. 
unfortunately, that .class is calling System.exit(0) and stopping the 
entire vm, which ant is running on.  how do i fork a new java vm within my 
custom task for the third-party java .class to execute in?

thank you. 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: forking new jvm in ExecuteJava?

Posted by tek1 <te...@pobox.com>.
thank you very much.

using execute rather than executeJava seemed to do the trick.



At 13:14 02/04/10 +1000, you wrote:
>On Wed, 10 Apr 2002 12:57, tek1 wrote:
> > hello.
> >
> > i've written a custom task that make a call to a third-party java .class.
> > unfortunately, that .class is calling System.exit(0) and stopping the
> > entire vm, which ant is running on.  how do i fork a new java vm within my
> > custom task for the third-party java .class to execute in?
> >
>
>You'll need to use CommandlineJava and Execute, rather than ExecuteJava:
>
>-  Create and configure an instance of CommandlineJava.  You configure it
>pretty much the same way as ExecuteJava - setClassname(), createClasspath(),
>createArgument(), etc.
>
>- Call getCommandline() to build the command-line.
>
>- Call static method Execute.runCommand() to execute the command.
>Alternatively, you can instantiate an Execute object, configure it manually,
>then call it's execute() method.
>
>--
>Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: forking new jvm in ExecuteJava?

Posted by Adam Murdoch <ad...@apache.org>.
On Wed, 10 Apr 2002 12:57, tek1 wrote:
> hello.
>
> i've written a custom task that make a call to a third-party java .class.
> unfortunately, that .class is calling System.exit(0) and stopping the
> entire vm, which ant is running on.  how do i fork a new java vm within my
> custom task for the third-party java .class to execute in?
>

You'll need to use CommandlineJava and Execute, rather than ExecuteJava:

-  Create and configure an instance of CommandlineJava.  You configure it 
pretty much the same way as ExecuteJava - setClassname(), createClasspath(), 
createArgument(), etc.

- Call getCommandline() to build the command-line.

- Call static method Execute.runCommand() to execute the command.  
Alternatively, you can instantiate an Execute object, configure it manually, 
then call it's execute() method.

-- 
Adam

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>