ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Developing in Java with ANT
Date Wed, 18 Mar 2009 17:51:16 GMT

You need to include ant-launcher.jar to get the AntMain interface.  This probably should be
in the core Ant jar but would take a little refactoring.  We'll keep it in mind for 1.8.0.

-Matt

--- On Wed, 3/18/09, David Nemer <davidnemer@gmail.com> wrote:

> From: David Nemer <davidnemer@gmail.com>
> Subject: Re: Developing in Java with ANT
> To: "Ant Users List" <user@ant.apache.org>
> Date: Wednesday, March 18, 2009, 12:38 PM
> Hey, everyone, thank you for you
> help.
> 
> I stick with the solution from Gawor (
> http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
> ):
> 
> File buildFile = new File("build.xml");
> Project p = new Project();
> p.setUserProperty("ant.file",
> buildFile.getAbsolutePath());
> p.init();
> ProjectHelper helper = ProjectHelper.getProjectHelper();
> p.addReference("ant.projectHelper", helper);
> helper.parse(p, buildFile);
> p.executeTarget(p.getDefaultTarget());
> 
> It seems pretty simple, but when it tries to run the
> "p.init();" I get the
> following error:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/tools/ant/launch/AntMain
>     at java.lang.ClassLoader.defineClass1(Native
> Method)
>     at java.lang.ClassLoader.defineClass(Unknown
> Source)
>     at
> java.security.SecureClassLoader.defineClass(Unknown Source)
>     at
> java.net.URLClassLoader.defineClass(Unknown Source)
>     at java.net.URLClassLoader.access$000(Unknown
> Source)
>     at java.net.URLClassLoader$1.run(Unknown
> Source)
>     at
> java.security.AccessController.doPrivileged(Native Method)
>     at java.net.URLClassLoader.findClass(Unknown
> Source)
>     at java.lang.ClassLoader.loadClass(Unknown
> Source)
>     at
> sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>     at java.lang.ClassLoader.loadClass(Unknown
> Source)
>     at
> java.lang.ClassLoader.loadClassInternal(Unknown Source)
>     at
> org.apache.tools.ant.Project.initProperties(Project.java:308)
>     at
> org.apache.tools.ant.Project.init(Project.java:295)
>     at testAnt.main(testAnt.java:14)
> 
> 
> THis line 14 refers to p.init();
> 
> Do you guys have any clues what it might be??
> 
> 
> --
> David Nemer
> Sent from: Kaiserslautern RP Germany.
> 
> On Tue, Mar 17, 2009 at 9:42 AM, Felix Dorner <FDorner@zed.com>
> wrote:
> 
> >
> > Whoops
> >
> > > Maybe you look for something like this:
> >
> >
> > http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
> >
> > Felix
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message