This is a rewrite to consolidate what I have picked up searching for answers to resolve my problem. I had installed Ant. When I used "ant" on the Command Line, I got the message "ant is not recognized as an internal or external command, operable program or batch file." I quickly established this was a problem with my Environmental Variables.
I am assuming you have already got instruction on changing your Environmental Variables. The bullet points below cover the finicky bits, the assumed knowledge, that those writing instructions do not tell you. I suggest just stepping through them when trying to resolve this.
It will be important to know I am running Windows7. These points are likely fairly universal for Windows, but I leave that for the reader to establish.
If your issue is still not resolved, please create a new question, perhaps referring back to this one. Do not ask for help on this question as it has been resolved. Other solutions found though can be added here (or posted & I will add them).
You have solved the Environmental Variable problem once you can get a version number from the Command Line (eg: "ant -version" or "java -version"). After that, you have a different problem. I spent an extra 2 hours trying to 'fix' a "Buildfile: build.xml does not exist! Build failed" Command Line error, not realising that meant this problem was fixed and I had moved onto another one.
One last piece of advice. Copy and paste your entire PATH variable to somewhere safe while you are playing with it. If you accidentally hit "Delete", you do not get an opportunity to recover and that could lead to a lot of pain.
Step through these;
If Command Line "echo %JAVA_HOME%" returns "%JAVA_HOME%", then you possibly have a permissions issue (use your %variable% not my %JAVA_HOME%);
Using User variables was the last problem I had to fix. Bizarrely "echo %JAVA_HOME%" was fine, but "echo %ANT_HOME%" returned "%ANT_HOME%".
Finally, if all else fails;
My thanks to those that helped & the previous Stack Overflow authors whose posts I read trying to find solutions.
Windows console need to be restarted to apply changes made in environment variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With