I just downloaded the Android Studio. While trying to run it, I had to modify the environment variable and add
JAVA_HOME
and
<Updated android studio to 1.2.1. Even though I was getting the same error. Nothing worked, finally replaced JAVA_HOME with JDK_HOME and it did the magic.
My problem was different to any of the above as far as I can tell. I had a working version 1.1 of Android Studio and upgraded to 1.2 Then I got the JAVA_HOME error when starting 1.2
The problem was that my JAVA_HOME was set to "C:\Program Files\Java\jdk1.8.0_20" with quotation marks included. I haven't put them there to quote the string, the quotation marks were in the Variable Value field. It appears that 1.1 is happy with the quotes being there but 1.2 is not.
Removing quotes removed the error and 1.2 now opens fine
I had to put backslash at the end of path and it worked for me.
Earlier I was using
C:\Program Files\Java\jdk1.7.0_79
just by putting "\" at the end, worked for me. Now the value of the JAVA_HOME variable is
C:\Program Files\Java\jdk1.7.0_79\
In my case it was because of an invisible character at the beginning of the path:
I had this problem as well, and I must have tried 20 different path adding solutions before I worked it out. Someone mentioned it above almost as a side note, but this was exactly my issue:
make sure you are running a 64-bit version of java.
I am using 64-bit Windows. After battling with various settings I followed these steps:
In the last step please note that its the parent Folder and not the \bin sub-folder. It started working.