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
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: 5812

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
It is sorta covered in the JavaRanch Style Guide.
subject: ANT: run Java code
Similar Threads
MySQL with ant: can not find driver class
Apache Ant add property file and policy file
Building Seam projects in Eclipse
Build problem when including third party jars in classpath using ant
could not find the main class