ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <>
Subject Hi, all. How do I protect myself from System.exit?
Date Wed, 29 May 2002 02:57:08 GMT
Hi, all.

I have a task that I have written that calls the main method of a java 
class after doing some parameter munging.  This main method does a 
System.exit.  I cannot easily rewrite that part of the code, so I need 
to work around it.

I presume the "right way" is to just fork.  I looked at the docs, and it 
indicates that Java and ExecuteJava will handle this, but I kind of 
foundered looking at the taskdef javadocs for Java and ExecuteJava.

Assuming I have a Task already written with a stack of instance 
variables, getters, setters, and a working execute method that ends with 
a call to the main class of the thing I am wrapping.

Can anyone point me to how I need to modify this to use the appropriate 
fork code?  What follows is my best attempt, but the call appears to not 
have the same classpath as the task that spawned it.

public class AntIntercalateTask extends Task {
     boolean _theParam=false
     public void setTheParam(boolean theParam)
     public AntIntercalateTask()
           // worked, save for System.exit
	//String[] args={"param1", "value1"};

          // cannot find classpath

         CommandlineJava cmdline = new CommandlineJava();

         Execute exe=new Execute();
         } catch (Exception e){

So, how can I transplant the classpath from the taskdef?


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

View raw message