I'm gonna try and cover the two OS's here so be kind.
First things first, goto http://ant.apache.org/bindownload.cgi and download the appropriate archive (zip) file: apache-ant-[VERSION NUMBER HERE]-bin.zip
Here's a windows installer for Ant that I made: http://code.google.com/p/winant/ I hope it's useful, and let me know if you'd like to develop it further.
I have installed ant 1.8.1 on my Windows XP and set the path varieable to the bin folder of ant. But, when i typed 'ant' in command line i am getting this error messaeg- 'ant' is not recognized as an internal or external command, operable program or batch file.
@suresh, I was having these problems too, I don't think changing the environmental variables takes effect until you reboot. Try setting them in the instance of the command line prompt you have running.
@Andy, thanks for this, I was muddling through the Apache Ant docs and getting nowwhere, can be frustrating as I don't even want ANT, I just want what it will build for me!