Have you installed Android Studio and it doesn’t start after clicking the program icon? The fix is simple. Firstly, you should download (update to) the latest Java Development Kit (current version is 7u21).
One of my Java friends told me not to install Java (and anything Java related) to the default installation path because of spaces in the path (there’s a space in the Program Files) and have a special directory for Java like C:/Java/… Spaces in the path might cause errors.
I am punk so I am using the default paths anyway
Setting system variable – PATH
Notice: I will be working with Java path C:\Program Files\Java\jdk1.7.0_21\, it could be something else in your case, just check the path and if you have installed Java somewhere else, change it to desired destination.
Type SET PATH in commnad prompt, you should have something like C:\Program Files\Java\jdk1.7.0_21\bin in there. If not, open Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables and in System variables modify the PATH variable. Add C:\Program Files\Java\jdk1.7.0_21\bin to the end. Be sure there’s no space at the end of the line. See screenshots below.
Save the changes, you don’t need to restart computer, but you have to reload command prompt.
There might be a problem, check if you don’t have java.exe in the C:/Windows/System32/. If the file is in this location, you should rename (or delete if you are brave) it. Reload command prompt ant type java -version to check if everything is allright.
Set JAVA_HOME and JDK_HOME variables
JDK_HOME should be enough but someone experienced a problem without JAVA_HOME, so set them both for sure.
We are going to continue. Type SET JAVA and SET JDK to command prompt to check if the variables are set up. Are they not? Ok, you should add them to the system variables. Once again – Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables.
And that’s it, you are ready to go, everything should be set up and Android Studio should start right after you click the icon.