First of all install JDK on your system and follow steps to set up JAVA_HOME variable :
1- Go to Location where JDK is installed : C:\Program Files\Java\JDK
2- You will find jre and jdk folder.
3- Go to my computer and click on properties.
4- Click on advanced system settings
5- Go to java installation folder open jdk folder and then bin folder,select the folder path from address bar and copy selected path.
6- Go to Edit environment variable window, and click New and paste JDK location for user variable.
7- Do the same for System variable.
8-In Variable Name type JAVA_HOME
9-In Variable Value past the path to jdk folder
10-Run studio.exe as a administrator.
JVM and JAVA_HOME problem(error) will be fixed now
Workd for :
Android Studio
Java , J2EE , Eclipse , Selenium , Testing, Coding
Python
PHP
C#
Django
Ruby