File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT: run Java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ANT: run Java code" Watch "ANT: run Java code" New topic

ANT: run Java code

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I have the following folder strcuture for my Java application

Using an ANT script, I need to compile and run the code. contains the main method.
folders "lib" and "resources" should be in classpath.

this is the ant script that I have written


the code compiles fine but when I run it, I get the following error

Please let me know how to resolve this.

thank you
Peter Johnson

Joined: May 14, 2008
Posts: 5852

The targets in the build script have no dependencies. How are you running Ant? Hopefully as:

ant compile jar run

Does the DmsOperations.jar file appear in the lib directory? What is it's contents? (You can find that out by running "jar -tf lib/DmsOperations.jar")

Also, try running Ant with the -v option - this might give you more information about what is going on.

JBoss In Action
I agree. Here's the link:
subject: ANT: run Java code
It's not a secret anymore!