Here, I would like to explain you about how to build a Java Project using Apache ANT(Another Neat Tool). Maven is also a build tool but I prefer ANT over Maven. A build tool like ANT, can be used to automate certain repetitive work, not only to build Java projects. When creating jar files, compiling source codes , etc a build tool plays a major role.
So, enough talking about the tool. let’s get our hands dirty. First we have to install Apache ANT.
Linux Users – type in the terminal, apt-get install ant to install it.
Windows Users –
- Download the ZIP file Apache ANT from this site.
- Extract the file into any location (for this Example let’s assume that the zip file is extracted to the C drive).
- Go to Environmental Variables Menu (Right click on the My Computer > Properties > Advanced System Settings > Environmental Variables)
- Add a new User Variable (Not a System Variable). Variable Name – ANT_HOME , Variable Value – C:\apache-ant-1.8.2
- Add another User Variable. Variable Name – JAVA_HOME, Variable Value – “Path to Java JDK”
- Add “C:\apache-ant-1.8.2\bin” to Path variable (Path Variable is at the System Variables Section)
Now you are done with the installation part. To check whether the ANT is running without any errors, Open Command Prompt and type ant -version and there will be a massage displaying the compilation date. If not, try again. 🙂