ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <>
Subject RE: Build and Confiuration Managment with Ant... a.k.a. running A nt _ from_ JSP/Servlet
Date Thu, 16 Aug 2001 14:36:43 GMT
> -----Original Message-----
> From: Blackard, Robert []

> I must disagree with your comment that System.exit() calls 
> are 'somewhat
> normal'... yes it might be commonly done, but I don't beleive 
> it should be
> and according to the Java specifications it is by no means normal.

If you are invoking it from the command line it is perfectly normal to me.
It is of course not normal to splattered your source code with System.exit
in every place. Javadoc is not different, Xalan command line as well.

System.exit are only in the command line method.

> The Fathers of Java intentionally and implicitly defined the 
> main() method
> to be void.  This wasn't something they just pulled out of 
> the air, nor was
> it something that they did because it's how every other 
> system did it -
> quite the contrary, this is a departure from the standard 
> practice and was a
> very concious decision on their part.

A main method is supposed to give you an entry point from the command line,
certainly not from within an application.

If you decide to run it this way, this is fine. But you should know what you
are doing and the consequences between something done to return status code
indicating error.

Once again main is for command line.

> That said, the standard argument for using a System.exit() is that it
> support the use of scripting with tools like a Unix shell or Perl.
> Certainly, providing an exit code is a means to support this, 
> but again, not
> all operating systems support exit codes.

All operating system do not have a file system.
All operating system do not have environment variables.
All operating system do not have a JVM.

> Finally, since I don't expect the definition of
> to change since it's out 
> there in so many
> places, may I suggest alternatively that you implement the
> method that throws 
> exceptions, and modify
> to call 
> and
> generate System.exit(0) if no exception is thrown and 
> System.exit(1) if an
> exception is thrown.  That way, those of us that wish to use Ant from
> another Java process can do so without overriding the 
> Security Manager.

It's already there.
Subclass Main and run it via runBuild if you don't want to retype code to
setup Ant.

You have the choice here...I don't understand what the problem is.

 St├ęphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - 
 Disclaimer: All the opinions expressed above are mine and not those from my

View raw message