Everytime i try to build my android platform on ionic I am greeted by the error stating that my JAVA_HOME is invalid whereas it points to the correct path as seen below. I have tried removing and re-adding the platform and re-adding the paths in the environment variables but nothing seems to work. I have been trying to troubleshoot this error for days now. Please help!
Input:
ionic build android
Output:
[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.7.0_75;
]
ERROR building one of the platforms: Error: C:\myApp\platforms\android\cordova\b
uild.bat: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: C:\myApp\platforms\android\cordova\build.bat: Command failed with exit co
de 2
at ChildProcess.whenDone (C:\Users\com\AppData\Roaming\npm\node_modules\cord
ova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Have you checked to see if the JAVA_HOME that it's referencing exists? Open up a command prompt and enter: "%Java_home%/bin/java" -version
to see what you get. If you get anything other than version information from Java, you need to verify and update your System Variable for JAVA_HOME in your Windows Environment Variables.
I had a similar problem,
in my case i set JAVA_HOME=\\Java\\jdk1.7.0_45
and my actual installed version was under jdk1.7.0_75
.
So check installed version is jdk1.7.0_75
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.