views:

606

answers:

3

Hi,

I'm having a very weird issue with the command line and running Ant. I point the path variable at the location of my Ant bin directory (C:\Ant\bin) and when i go into a command window and type PATH it shows the location in it. But when I go to run Ant by typing "ant" it does nothing and states that it isn't recognized. But when I go to the run window (Windows+R) and type "ant" it runs it.

I have restarted Windows twice and the problem still persists. I am running Windows Vista Ultimate with SP1 installed. I have tried "Running as Administrator" with no difference.

Any one experience anything like this before?

+2  A: 

Sometimes you can set a system-wide (or even just personal) Environment Variable and it'll cure it, as opposed to just setting it in your shell.

Go to the Control-panel, then System, then Advanced, and look for the button on Environment Variables. From there, you can follow your nose.

Good luck.

Richard T
That's where I set the path, but thanks for the response.
Adam Driscoll
+1  A: 

Ant also depends on Java to be on the path. Do you have that?

I would also check to make sure the environment variables ANT_HOME and JAVA_HOME are set up properly in the console.

Tommy Hui
Both have been set per Ant installation settings. Thanks for the response.
Adam Driscoll
A: 

Is there any chance that the command window you are trying to run Ant in is a different window to the cmd windwo where you set up and verify that its in the path? If the PATH is updated after a cmd window is already open it won't recongnise the change. Not clear if that might be your issue.

If you are in the dir C:\Ant\bin and type "ant" does it recognise it?

MadMurf
When I'm in the bin directory it runs Ant just fine. I have set the Env var and restarted the system but it still doesn't work. I didn't use the set command I rather used the Advanced System settings dialog. Thanks for the response though.
Adam Driscoll