我有cordova的hello模板并添加了android。现在,我将JAVA_HOME设置为环境变量和系统变量,它们都引用了“ C:\ Program Files \ Java \ jdk1.8.0_211 \ bin”。在路径中,我添加了%JAVA_HOME%\ bin。在hello目录中运行“ cordova build android”后,我得到了
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.8.0_211
如果我输入javac -version
,则会得到javac 1.8.0_211
。如果输入echo %JAVA_HOME%
,将得到C:\Program Files\Java\jdk1.8.0_211
,这是正确的路径。我已经咨询了有关此问题的以前的文章,但仍然收到相同的错误消息。自安装Android Studio以来,这可能是一个Android问题。