I created a build file using Export option in the context menu of the Eclipse project. Creating the build.xml was not a difficult thing, so to speak as it was managed by Eclipse.
Then I ran the build file by right clicking on it - and selecting the desired option. Now I added a sample java class in the default package. But running the build did not run this Java class.
This is the build.xml:
Some doubts that popped up into my head; how do I run the project after successfully building it? It appears from the docs that I would need a separate <target>. If I have two class files that I have to execute back to back what steps do I take?
And if I have to build this project from command line, how would I proceed? I'm new to Ant and will deeply appreciate your thoughts.
What do you mean by not running the second file? Did it not create a .class file? Or something else? To troubleshoot the problem, try right clicking the Ant xm and choosing "run as" > "Ant build...". The put "-v" in the main tab's argument section. That puts Ant into debug mode. Post the output here. (assuming it is very long, the last 50 lines should be fine)
To run at the command line, you type ant nameOfBuild file. You might need to add Ant to your path. (It can be found in the plugins directory of Eclipse or you can download it from the internet.)
This isn't the problem, but it isn't good practice to use the default package.