I think if I understand you correctly you want to execute your build through a class using ANT's api. To do that your classpath or archive must have the ant-launcher.jar and ant.jar packages either in the path or unpacked and included in your archive.
-----Original Message----- From: Frank Harnack [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 26, 2005 11:00 AM To: Ant Users List Subject: Re: where to get some programm examples Hello wei wei, I am not sure what you want. If you want to call ant directly from java, this Ant Users List message may help you: http://marc.theaimsgroup.com/?l=ant-user&m=112612267300036&w=2 Regards Frank wei wei schrieb: > Hello, > > I have one build.xml file. now i want to control the running of this > ant build.xml in java code. > <?xml version="1.0" encoding="UTF-8"?> > <project default="build1" name="XMLExport" basedir="."> > <property environment="env"/> > > <property name="temp.dir" value="../temp"/> > <property name="out.dir" value="../out"/> > <target name="build1"> > <zip destfile="${out.dir}/result.zip" > basedir="${temp.dir}"/> > </target> > <target name="hello"> > <echo message="Hello, world (${name})"/> > </target> > > </project> > > public static void main(String[] arg) { > Project project= new Project(); > File buildfile = new File("build.xml"); > ProjectHelperImpl helper = new ProjectHelperImpl(); > helper.parse(project,buildfile); > project.setProperty("name", "wert"); > project.executeTarget("hello"); > > then i got a very long error message, it seems like the application > can > not find my ant api(.jar files). > does any one have this experience? > Thanks a lot. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- Frank Harnack 47269 Duisburg Deutschland (Germany) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]