Ikeh Henry
Ikeh Henry

Reputation: 41

JAVA_HOME is invalid (cordova) error

I have been experiencing this error for the past 7 days. I have researched various helps online but all to no avail:

I am using windows 10, 4gb RAM, 32 bit.

(node:2240) UnhandledPromiseRejectionWarning: CordovaError: 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. Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.8.0_172

What should I do?

Upvotes: 2

Views: 10969

Answers (4)

Franny
Franny

Reputation: 11

I hope this info can be usefull... this is a resume from many threads I read on Internet...

I have Windows 10 x64

Previously I installed JRE, JDK and Android Studio.

Here is where you can find Android SDK path on your system after install Android Studio

After to set on system enviroments vars JAVA_HOME and ANDROID_HOME (with android sdk path), then I added to path var the following:

  • %JAVA_HOME%\bin
  • %ANDROID_HOME%\tools

Now You could run cordova run android and cordova build android commands from cmd.exe console.

From Git Bash MINGW64 I always have your error.

My System Enviroments vars

My system path var configuration

Upvotes: 1

jguyet
jguyet

Reputation: 75

Change your environement vars install Java JDK and go to C:\Program\Java\YourJDK and copy path for add on Env

check here Java Help JAVA_HOME

Upvotes: 0

flyingfox
flyingfox

Reputation: 13506

The reason is that JAVA_HOME path have space for the value Program Files,you need add " to wrap it

JAVA_HOME="C:\Program Files"\Java\jdk1.8.0_172

Upvotes: 2

Juan David Angarita
Juan David Angarita

Reputation: 24

Did you check the jdk folder? Btw check this https://www.mkyong.com/java/how-to-set-java_home-on-windows-10/ Maybe you just need update your path as the article said in the step 4.

Upvotes: -1

Related Questions