tags:

views:

1028

answers:

2

Hi all,

I have installed ant(apache-ant-1.7.0). But when i run the ant command in dos command prompt, it says

‘ant’ is not recognized as an internal or external command, operable program or batch file.

where i'm going wrong.

+2  A: 

That just means it's not on the path.

Edit your PATH environment variable to include Ant's "bin" directory. The exact steps for editing your path with depend on your operating system, but for example on XP:

  • Bring up Explorer (Windows-E)
  • Right-click on "My Computer" and select "Properties"
  • On the "Advanced" tab, click on "Environment Variables"
  • If the set of "user variables" already contains a PATH entry, edit that. Otherwise create a new entry. (If you want it to affect all users, set it as a system environment variable.)
  • Add the Ant bin directory without any quotes. Use a semi-colon to separate it from another entry. For example, you might have:

    c:\Program Files\Utils;c:\Program Files\Ant 1.7\bin
    
  • Start a new Command Prompt to see the changes (they won't affect existing windows)
Jon Skeet
I have already set the bin directory to the PATH variable.but it is working when i logon as administrator. when i login as some user account, it throws error like this.
Srinivasan
Then that suggests you've set the PATH variable just for the administrator. Either set it for the individual user, or for the system.
Jon Skeet
I set it(PATH) in the System variable by administrator login.When i enter echo %path%(from the administrator account) in the command prompt, ant path is included in the PATH system variable.But when i login in my login and enter echo %path%, it does not include the ant path.Can i restart the system after PATH setting?
Srinivasan
I would have expected logging in again from scratch to be okay, but just switching user wouldn't. But try a reboot and see if that fixes it for you, certainly.
Jon Skeet
Ya. After i restarted my system, it is working fine. Thanks.
Srinivasan
A: 

For anyone that comes across this article:
Always remember, don't put a space after each semicolon.


Good:
C:\Ninja;C:\ant

Bad:
C:\Ninja; C:\ant

RichardJohnn