Peter Johnson wrote:The problem is that you don't understand how packages relate to classpaths. You should have cd'ed to the D:\workspaces\Java_app\antSample\src directory and then run "java app.main.Main", then it would have found the class. (Note that the javac compiler deals with files within directories, whereas the java runtime deals with classes within classpaths, and packages are part of the class name.)
But that is not the same issue you ran into with Ant because the way your build script is set up, doing "ant compile jar run" works for me.
Peter Johnson wrote:Is the file hierarchy you posted correct, or is there a typo? Specifically, is the Main class source at antSample/app/main/Main.java or at antSample/app.main/Main.java? Please post the contents of the JAR file by running "jar -tf path/to/antSample.jar"
You didn't show enough of the build.xml. What is ${mainclass}? Where are you compiling your source files to? It is that directory that you should use for <jar ... basedir="xxx"> (the xxx should be the directory into which the class files were compiled, not ${basedir}).
Tomahawk is what creates that object - not Spring.