ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nemer <davidne...@gmail.com>
Subject Re: Developing in Java with ANT
Date Wed, 18 Mar 2009 17:38:01 GMT
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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message