ant runs in the Java VM so ANT is task of the JVM you can run 'ant' in a shell via Runtime.getRuntime.exec("ant.bat target"); but in that case a JVM would be executing another JVM process
I would suggest thinking about incorporating the necessary ANT taskdef classes into an included jar so your desktop or web application can incorporate the requisite functionality by adding that jar to your classpath HTH Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality note Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. > Date: Mon, 16 Mar 2009 22:26:28 +0100 > Subject: Re: Developing in Java with ANT > From: davidne...@gmail.com > To: user@ant.apache.org > > Hello David and Martin, > > Thank you for your answers. But, I was just wondering how can I do this, run > ant, coding in JAVA. As I studied the Ant manual from Apache before, I could > figure out how to run it in the command line, but I don't seem to be able to > run ANT in Java coding. > > So, is there a way to call the command ANT in Java coding? > > -- > David Nemer > > On Mon, Mar 16, 2009 at 10:14 PM, Martin Gainty <mgai...@hotmail.com> wrote: > > > David > > > > make sure your class gets on the classpath before you use it with ant e.g. > > > > assume the java file is located in .\packageName\david.java > > javac .\packageName\david.java > > > > assume the new class is packaged in david.jar > > jar -cvf david.jar .\package\*.* > > > > ant -lib .\Path\To\david.jar -f build.xml > > > > HTH > > Martin > > ______________________________________________ > > Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality note > > > > > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > > dient lediglich dem Austausch von Informationen und entfaltet keine > > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > This message is confidential and may be privileged. If you are not the > > intended recipient, we kindly ask you to please inform the sender. Any > > unauthorised dissemination or copying hereof is prohibited. This message > > serves for information purposes only and shall not have any legally binding > > effect. Given that e-mails can easily be subject to manipulation, we can > > not accept any liability for the content provided. > > > > > > > > > > > > > > > Date: Mon, 16 Mar 2009 22:03:43 +0100 > > > Subject: Developing in Java with ANT > > > From: davidne...@gmail.com > > > To: user@ant.apache.org > > > > > > > > Hello Everyone, > > > > > > I'm really new to Ant, and I need some help, my task is to code in JAVA a > > > program to checkout a version of a open source project, compile it and > > run > > > the test script which is in ANT. > > > > > > I'm working on the Ant-Doxygen Project (but it could be any project). > > > http://sourceforge.net/projects/ant-doxygen > > > > > > I'm already successful with coding the "checkout a version of a > > repository" > > > part. > > > > > > In Ant-Doxygen project, they already have an XML file to build the > > project. > > > So once I have checked out the Project, all I need to do I to run ant to > > > build the project. But, how can I code a way to run Ant to build this > > > project? ( I need to code that in Java... I can't just go to my command > > line > > > and run Ant.) > > > > > > Thank you so much in advance > > > -- > > > David Nemer > > > > ------------------------------ > > HotmailĀ® is up to 70% faster. Now good news travels really fast. Find out > > more.<http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009> > > _________________________________________________________________ Express your personality in color! Preview and select themes for HotmailĀ®. http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme