Failed to find 'JAVA_HOME' environment variable

When i build the app showing an error.

Below my error

(node:2864) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): CordovaError: Failed to find 'JAVA_HOME' environment variable. Try
setting it manually.
(node:2864) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.

How can i fix that.
Please help me


Make sure that in a new console window the output of echo %JAVA_HOME% is really “C:\Program Files\Java\jdk1.8.0_40 or up-to-date version” so you know your changes of the environment variables are in effect.

I’m also getting the same error on linux mint. I have checked for all environment variables and they’re okay. when I echo JAVA_HOME in my terminal it shows the correct path.

Could you solve it? i’ve the same problem :cold_sweat:

I have the same same problem :frowning: did you solve it?

Sorry, can’t help you because you seem to use a different OS than Windows which is what I use.
On Windows (10) this is what you do:

  1. right click This PC and click properties (this will bring you to Control Panel\All Control Panel Items\System)
  2. On the left menu click Advanced System Settings.
  3. You’ll get this window

    click on Environment Variables
  4. There’s two things we need to do here. First one is to add a new variable (user or system doesn’t matter as far as I know, I have it on both just in case) called JAVA_HOME with your Java folder as value and click OK
  5. You find a variable called Path and click Edit
  6. From there you tap New and add your bin folder from the Java folder. For me that is C:\Program Files\Java\jdk1.8.0_144\bin and click OK. Now you want to move that folder to the top using the Move Up button
  7. Open CMD and run refreshenv
  8. Try the command java -version, if you have the correct output you should be good now.

Thanks Strinix for your reply. Another question, how did you managed to install the 1.8 JDK? I browsed in the Java Download page and it only shows the latest version.

1.8 version whould be a legacy or LTS version of Java JDK?

Thank you in advance

Please create a new topic because your question is not similar to this question

Installed it a long time ago but found this with a quick google.
That should be 1.8, not entirely sure though.