Search code examples
javaandroidcordovaandroid-studiophonegap

Phonegap Build Error: Failed to run "javac -version", make sure that you have a JDK installed


running:

phonegap build android

with android SDK and Java SDK installed, I get the following error:

Error: Failed to run "javac -version", make sure that you have a JDK installed. You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.

I have tried adding the "java\jdk-9\bin" to environment variables, and PATH, etc. No luck!

My suspicion is that phonegap is trying to use the runtime version of Java as opposed to the SDK.


Solution

  • I had this problem and I solved it by uninstalling jdk-9 and installing JDK version 8.

    Then set up the environment variables where needed (JAVA_HOME & add \bin to Path)