简体   繁体   English

系统找不到指定的路径(Java开发工具包)

[英]The system cannot find the path specified (Java Development Kit)

I just started working with Cordova/PhoneGap and when I want to use the command "cordova run android" on my newly created application, it goes somewhat like this: 我刚开始使用Cordova / PhoneGap,当我想在新创建的应用程序上使用命令“ cordova run android”时,它的内容如下:

C:\Users\tobbog\Desktop\MyNewApp>cordova run android
ANDROID_HOME=C:\Users\tobbog\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_144
The system cannot find the path specified

However, the two paths above are both perfectly like that in my Environmental Variables. 但是,上面的两条路径都非常类似于我的环境变量中的两条路径。 How can it be that it doesn't find the path? 找不到路径怎么可能?

Thanks in advance for any help! 在此先感谢您的帮助!

Remove android by the below command 通过以下命令删除android

cordova platform rm android

Then add the version 5 by the below command 然后通过以下命令添加版本5

cordova platform add android@~5

That should help! 那应该有帮助!

You may also want to place the paths in quotation marks " ", since it's possible the space in "Program Files" is throwing it off, I know this happens often when trying to run certain programs via command line that take file arguments. 您可能还希望将路径放在引号“”中,因为“程序文件”中的空格可能会将其删除,我知道在尝试通过命令行运行带有文件参数的某些程序时经常会发生这种情况。 So maybe write it like this: 所以也许这样写:

C:\Users\tobbog\Desktop\MyNewApp>cordova run android
ANDROID_HOME="C:\Users\tobbog\AppData\Local\Android\sdk"
JAVA_HOME="C:\Program Files\java\jdk1.8.0_144"

Can't be 100% sure though as I'm unfamiliar with what that program expects (cordova) and other options that may be supplied to it! 但是,由于我不熟悉该程序的期望值(cordova)以及可能提供给它的其他选项,因此无法100%确定! You could always try checking the readme or documentation related to that program, it probably shows some examples as to how to run something similar. 您总是可以尝试检查与该程序相关的自述文件或文档,它可能显示了一些有关如何运行类似内容的示例。

See how it even changes in the Stack Overflow text formatting? 看看它在Stack Overflow文本格式中如何变化? It's possible once it hits that white space after Files (in C:\\Program Files) that it's ignoring the rest of the path, so basically you're trying to specify this path for JAVA_HOME: 一旦它在文件(在C:\\ Program Files中)之后碰到空白,就有可能忽略其余路径,因此,基本上,您正在尝试为JAVA_HOME指定此路径:

C:\Program

And that's it! 就是这样! Would explain why it can't find that path since you probably don't have just a "Program" directory! 将解释为什么它找不到该路径,因为您可能没有“ Program”目录!

I found the answer to my problem! 我找到了问题的答案! The problem was that I installed and uninstalled the Android Development Kit before. 问题是我之前安装和卸载了Android Development Kit。 During the uninstal, it didn't delete all of the folders so that I had to delete them manually before installing Android again. 在取消安装过程中,它没有删除所有文件夹,因此在再次安装Android之前我不得不手动删除它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM