Running command: “C:\Program Files\nodejs\node.exe” C:\Users\Ayushman\Documents\Android\myApp\hooks\after_prepare\010_add_platform_class.js C:\Users\Ayushman\Documents\Android\myApp
add to body class: platform-android
Running command: cmd “/s /c “C:\Users\Ayushman\Documents\Android\myApp\platforms\android\cordova\build.bat””
[Error: Failed to run “java -version”, make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.8.0_60
ERROR building one of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
at ChildProcess.whenDone (C:\Program Files\nodejs\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
please i need a guard, i am stucked here, i fellowed the installation instructions from getting started but at the point of building my ionic projects , this is the error i get. please any help will be greatly appreciated.
I just had the same problem. I was sure that I installed the JDK and that the JAVA_HOME path was set correctly. However it turned out that I unselected one component during the JDK installation process because I thought that it would install the Java IDE. That resulted in that the java compiler (javac.exe) wasn’t installed. “java.exe” was installed correctly.
The error was gone, after I’ve reinstalled the JDK with all available components.
This is how you can check if your JDK and JAVA_HOME var are installed properly (on Windows):
Open a command promp and enter: