即使在 Windows 8 Enterprise 上设置了路径,也无法运行 JAVA - Cordova [英] Failed to run JAVA even though path is set on Windows 8 Enterprise - Cordova
问题描述
我创建了一个新的 Ionic/Cordova 项目,我正在尝试在 Windows 8.1 上构建它.我安装了 JDK 和 JRE 7 以及 android sdk 和 ant,并使用以下说明将它们添加到我的路径中.
I have made a new Ionic / Cordova project and I'm trying to build it on windows 8.1. I installed JDK and JRE 7 as well as android sdk and ant and added them to my path using the following instructions.
cordova 平台添加 android 不在列出 Android 目标时工作
当我执行 ionic platform add android
或 cordova
时,我仍然收到以下错误:
When I execute ionic platform add android
or cordova
I am still getting the following error:
C:UsersBogdanR.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:126
throw e;
^
Error: Failed to run 'java -version', make sure your java environment is set up
including JDK and JRE.
Your JAVA_HOME variable is C:Program FilesJavajdk1.7.0_51
Error: Command failed: 'java' is not recognized as an internal or external command,
operable program or batch file.
at C:UsersBogdanR.cordovalibandroidcordova3.4.0inlibcheck_reqs.js:62:22
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:
odistin
ode_modulescordovasrcsuperspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Unable to add platform android. Please see console for more info.
我尝试修改系统变量和用户 PATH 变量.
I tried modifying both system variables and user PATH variables.
奇怪的是我可以输入 java -version
并且它可以工作:
THE WEIRD THING is that I can type in java -version
and it works:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
如果有任何相关性,我正在使用 nodist 来管理 npm.
I am using nodist to manage npm if that is of any relevance.
推荐答案
路径中有一个错误的条目损坏了我的整个系统路径.
There was a bad entry in the path that corrupted my whole system path.
C:Program FilesMicrosoft SQL Server110ToolsBinn";C:Program FilesMicrosoftWeb Platform Installer;
那个引号好像是SQL Server安装或者web平台添加的条目.我从未将它们添加到路径中,所以可能是安装程序的错误?
Seems like that quotation mark is an entry added by SQL Server installation or web platform. I never added those to the path so it might be the installers fault?
这篇关于即使在 Windows 8 Enterprise 上设置了路径,也无法运行 JAVA - Cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!