环境变量的错误 - 不被识别为一个内部或外部命令 [英] Environment Variable errors - not recognized as an internal or external command

查看:263
本文介绍了环境变量的错误 - 不被识别为一个内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个改写巩固我拿起寻找答案来解决我的问题。我已经安装了Ant。当我用蚁族在命令行中,我得到了这个消息的蚁族不被识别为一个内部或外部命令,可操作的程序或批处理文件。我迅速建立这是一个问题与我的环境变量。

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.

这将是知道我运行Windows7的重要。这些点可能为Windows相当普遍的,但我留给读者来建立。

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).

您已经解决了这个环境变量的问题,一旦你可以通过命令行版本号(如:蚁-version或者Java的版本)。在此之后,你有一个不同的问题。我花了一个加收2小时试图修复了构建文件:build.xml文件不存在生成失败的命令行的错误,却没有意识到这意味着这一问题得到了解决,我已经移动到另一个

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.

最后一个忠告。复制和整个PATH变量粘贴到一个安全的地方,而你用它玩。如果你不小心点击删除,你没有得到一个机会来恢复,而且可能导致很多痛苦。

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.

通过这些步骤;


  • 关闭所有打开命令行控制台(视窗控制台),并重新启动它。这将重置变量,需要在这个每次进行更改环境变量的时间内完成。

  • 确保你没有留下空格的环境变量。在最后没有空间和变量之间没有空格。

  • 检查拼写是一致的,并检查您的位置是否正确。

  • 添加新文本到PATH变量,而不是结束的开始。这避免了与其他的东西和冲突的任何问题,如果你已经添加它不止一次。它停止读取第一个成功。

  • 确保PATH变量分号(;)。新加入和现有的文本(无空格),插入之间

如果命令行回声%JAVA_HOME%收益%JAVA_HOME%,那么你可能有一个权限问题(使用%变量%不是我的%JAVA_HOME%);

If Command Line "echo %JAVA_HOME%" returns "%JAVA_HOME%", then you possibly have a permissions issue (use your %variable% not my %JAVA_HOME%);


  • 把新的变量(如JAVA_HOME或ANT_HOME)及其路径,进入系统变量。从用户变量中删除。

使用用户变量是最后一个问题,我来解决。奇怪的是回声%JAVA_HOME%是好的,但回声%ANT_HOME%返回%ANT_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;


  • 重新启动计算机

  • 让你的软件的新副本,安装并重启。

我要感谢那些,帮助和放大器;在previous堆栈溢出作家的帖子我看了试图找到解决办法。

My thanks to those that helped & the previous Stack Overflow authors whose posts I read trying to find solutions.

推荐答案

这是输出装置的环境变量未设置。您可以使用控制台执行此操作:

That output means the the environment variable is not set. You can do this in the console with:

set variable=value

或者更好的去你的系统设置和永久设置。参见<一个href=\"http://www.windows7hacker.com/index.php/2010/05/how-to-addedit-environment-variables-in-windows-7/\"相对=nofollow>本网站如何设置。

这篇关于环境变量的错误 - 不被识别为一个内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆