Ionic Build Failed: JAVA_HOME is invalid

wanted to start my first build with ionic. But the Build fails very soon with the following error:

Running command: E:\Apps\ASV\Node\node.exe E:\Apps\ASV\Code\MyASV\hooks\after_prepare\010_add_platform_class.js E:\Apps\ASV\Code\MyASV
add to body class: platform-android
Error: Failed to run "java -version", make sure that you have a JDK installed.
You can get it from:
Your JAVA_HOME is invalid: C:\Program Files\java\jdk1.8.0_77

I tried several things over the past hour to fix this. I deinstalled all Java related stuff, reinstalled it, set the JAVA_HOME several times to the jdk path, added %JAVA_HOME%\bin to the path-variable, but nothing fixed it. Currently my JAVA_HOME, which i had to create manually, looks like this at the moment:

C:\Program Files\Java\jdk1.8.0_77

Please note that this path is different to the one in the error message. The ‘Java’ is written in lowercase and in uppercase, I don’t know if this is relevant. Also changing this JAVA_HOME variable and then trying a rebuild gives the same error, the changed variable seems to have no effect on the one ionic uses.

How can I fix this? What exactly is going wrong?

I solved it by adding the same path to the PATH variable.