ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Riddell <...@theriddells.org>
Subject Re: Calling Ant from Java: An example please ?
Date Wed, 13 Feb 2002 21:19:21 GMT
This page at Eclipse seems to speak to Eclipse <-> Ant integration:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-ant-home/ma
in.html

>From this description, I don't see that Eclipse is going to be using
the Ant APIs (unless I'm misunderstanding it).
It looks like that they're gonna auto-generate Ant build.xml files.

Do you know that they are actually using the Ant Java APIs ?

If so, I would be happy to download and grovel the code.

Thanks for your help.


On 2/13/02 12:54 PM, "David Goodenough" <david.goodenough@btconnect.com>
wrote:

> You could try downloading the source of Eclipse (www.eclipse.org)
> which uses Ant in very much the way you indicate, and that
> would be a worked example.
> 
> On Wednesday 13 February 2002 18:49, you wrote:
>> Thanks for the quick response  . . . but no ;-)
>> 
>> I want to accomplish this in Java by calling the Ant API.
>> 
>> I need to dynamically:
>>   - generate source code
>>   - compile what was generated
>>   - classload it
>>   - execute it
>> 
>> And I need to do all this as part of a larger application.
>> 
>> How's THAT for fun ?
>> 
>> On 2/13/02 10:47 AM, "Diane Holt" <holtdl@yahoo.com> wrote:
>>> --- Jay Riddell <jay@theriddells.org> wrote:
>>>> I have an application where I need to dynamically generate Java source
>>>> code, compile it, load it and then execute that code.
>>> 
>>> [snip]
>>> 
>>>> However, I'm sure that I'm not doing anything really difficult...I'm
>>>> just doing it wrong ;-).  A "compile Hello World"-type example would
>>>> save me BUNCHES of work and would be MUCH appreciated.
>>> 
>>> If I understand right what you want to do (but given the past two days,
>>> that's anybody's guess :), here's an example:
>>> 
>>> <target name="runHello" depends="gensrc,compile">
>>>   <java classname="HelloWorld" >
>>>     <classpath>
>>>       <pathelement location="."/>
>>>     </classpath>
>>>   </java>
>>> </target>
>>> 
>>> <target name="compile">
>>>   <javac srcdir="." destdir="." includes="HelloWorld.java"/>
>>> </target>
>>> 
>>> <target name="gensrc">
>>>   <echo file="HelloWorld.java">public class HelloWorld
>>> {
>>> public static void main (String [] args)
>>> {
>>>     System.out.println("Hello, world") ;
>>> }
>>> }
>>>   </echo>
>>> </target>
>>> 
>>> Diane
>>> 
>>> =====
>>> (holtdl@yahoo.com)
>>> 
>>> 
>>> 
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Send FREE Valentine eCards with Yahoo! Greetings!
>>> http://greetings.yahoo.com
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:ant-user-unsubscribe@jakarta.apache.org> For additional commands,
>>> e-mail: <mailto:ant-user-help@jakarta.apache.org>
>> 
>> --
>> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 


--
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