You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sk...@oksystem.cz on 2004/05/06 09:52:58 UTC
Call a class with params from ANT
Hello,
I'm a beginner with Java and using ANT ... and have a problem how to call a class with params - is it possible with ANT tasks? Or have I to create my own task? The constructor of the class needs 2 parameters.
Could somebody tell me where can I find any info about it?
Thanx for your answers.
Milan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Call a class with params from ANT
Posted by Ivan Ivanov <ra...@yahoo.com>.
Hello Milan,
Here is a real snippet of invoking class via ant
<java
classname="bg.unisofia.emaria.util.DBCreatorRunner"
fork="yes" failonerror="true">
<classpath>
<path refid="project.classpath"/>
<path refid="test.classpath"/>
<pathelement
location="${project.classes}"/>
</classpath>
<arg
value="http://localhost:8080/${project.name}/ServletTestRunner?suite=bg.unisofia.emaria.util.DBCreator"/>
<arg file="${test.output.file}"/>
</java>
This class requires two parameters which I pass them
to the class with <arg> attribute of <javac> task. All
other attribues this snippet is using are described
here:
http://ant.apache.org/manual/CoreTasks/java.html
Hope this helps
Ivan
P.S. You can run with java command and hence with ant
<java> task only classes that have main method. You
are mentioning that your class' contrucor requires 2
params. So you must pass the two params to the main
method and you call the constructor with them. I
suppose you know this and i explain it just in case
--- skalsky@oksystem.cz wrote:
> Hello,
> I'm a beginner with Java and using ANT ... and have
> a problem how to call a class with params - is it
> possible with ANT tasks? Or have I to create my own
> task? The constructor of the class needs 2
> parameters.
>
> Could somebody tell me where can I find any info
> about it?
> Thanx for your answers.
>
> Milan
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org