Java 错误:正在执行命令“ant”,请确保您已安装 ant 并将其添加到您的路径中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23321542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 21:53:11  来源:igfitidea点击:

Error : Executing command 'ant', make sure you have ant installed and added to your path

javaandroidcordovaantionic-framework

提问by Anurag Sharma

I am using Cordova for mobile application development.

我正在使用 Cordova 进行移动应用程序开发。

I have installed Cordova using npm command and after the installation, I have created a cordova project. Whenever I try to add a platform (android) to the project it throws following error:

我已经使用 npm 命令安装了 Cordova,安装后,我创建了一个cordova 项目。每当我尝试向项目添加平台(android)时,它都会引发以下错误:

Error : Executing command 'ant', make sure you have ant installed and added to your path

错误:正在执行命令“ant”,请确保您已安装 ant 并将其添加到您的路径中

Screenshot

截屏

I have already installed anton my system and configured path to %ANT_HOME%\binand other respective required platforms such as JAVA_HOME, ANDROID_PLATFORM_TOOLSand ANDROID_TOOLS.

我已经ant在我的系统上安装并配置了路径%ANT_HOME%\bin和其他各自所需的平台,例如JAVA_HOME,ANDROID_PLATFORM_TOOLSANDROID_TOOLS.

Whenever I execute the antcommand in cmd, no error's are thrown. For example, after the execution of ant -versioncommand in cmd received output is:

每当我ant在 cmd 中执行命令时,都不会抛出错误。比如ant -version在cmd中执行command后收到的输出是:

Apache Ant(TM) version 1.9.3 compiled on December 23 2013.

Apache Ant(TM) 1.9.3 版于 2013 年 12 月 23 日编译。

I went through many of the questions at Stack Overflow and solved the issue of tools.jarnot being present at JRE's Libdirectory. still the platform addis not working.

我在 Stack Overflow 上解决了许多问题,并解决了tools.jar没有出现在 JRELib目录中的问题。仍然platform add无法正常工作。

Please do help me out with this. Any help will be appreciated.

请帮我解决这个问题。任何帮助将不胜感激。

采纳答案by Anurag Sharma

At last I was able to figure out the answer of my question.

最后,我能够找出我的问题的答案。

After a long day, I tried adding IOS platform for same project and I received an error code 'ENOENT' through cordova.

经过漫长的一天,我尝试为同一个项目添加 IOS 平台,但我通过cordova 收到了错误代码“ENOENT”。

I did some R&D and finally found a solution at -- Phone Gap [error] cmd: Command failed with exit code ENOENT

我做了一些研发,终于在 -- Phone Gap [error] cmd: Command failed with exit code ENOENT找到了解决方案

Again thank you all for your precious time.

再次感谢大家的宝贵时间。

回答by Sultanos

I solved this same problem installing ant with a Windows installer contribution

我用 Windows 安装程序贡献安装 ant 解决了同样的问题

https://code.google.com/p/winant/

https://code.google.com/p/winant/