KaneHarry729
KaneHarry729

Reputation: 95

I keep getting "Failed to run "javac -version"" when I run 'cordova build android'

I have the hello template from cordova and added android. Right now, I have JAVA_HOME set as both an environment variable and system variable that refers to "C:\Program Files\Java\jdk1.8.0_211\bin". In path, I added %JAVA_HOME%\bin. After I run 'cordova build android' in hello directory, I get

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

If I type javac -version, I get javac 1.8.0_211. If I type echo %JAVA_HOME% I get C:\Program Files\Java\jdk1.8.0_211 which is the correct path. I've consulted the previous posts on this issue, but I still get the same error message. Thinking this might be an Android problem since installing Android studio.

Upvotes: 1

Views: 1127

Answers (1)

Dylan
Dylan

Reputation: 2219

You can use cmd + ; for Mac or Ctrl + Alt + Shift + S for Windows/Linux to pull up the Project Structure dialog. In there, you can set the JDK location as well as the Android SDK location.

enter image description here

Upvotes: 1

Related Questions