Android Studio Java setup using the JAVA_HOME variable

09/04/2016 R Tyler 0 Comments

Java Setup in Android Studio

I’ve just begun using Android Studio again after a long layoff. After noticing a sharp rise in configuration errors using the old version of the system, and taking the advice of forum posts on the subject, I decided to re-install the Android Studio Application from the recommended source website: An update to my current Java version was also required to support the new Application: I carried out this Java update with reservations, but knew it was a necessary step to support the new version of the IDE.

My chosen ANDROID STUDIO Version was 2.1 preview 5.

After downloading and opening the zip file provided I noticed that no installation is required to use the Application. I just had to drop the entire folder tree into my Program Files Directory. For the executable I had a look in the ‘C:\Program Files\android-studio\bin’ folder and sure enough found the required file. On running the .exe the following error dialog was generated which stopped my from continuing:

  "Error launching Android Studio"

    And the associated message read...

    Failed to create JVM: error code -4.
    JVM Path: C:\Program Files\Java\jdk1.7.0_75\jre
    If you already have a 32-bit JDK installed, define a JAVA_HOME variable in
    Computer > System Properties > System Settings > Environmental Variables.

By using the Control Panel I was able to navigate to the suggested configuration pane by selecting ‘System’ followed by ‘Advanced System Settings’ and the pressing the ‘Environmental Variables’ button. Here I noticed that the suggested JAVA_HOME variable was already set in the lower ‘System Variables’ panel. It turned out that I needed to add the ‘JAVA_HOME’ variable in the upper panel ‘User variables for Rob’, in order to get Android Studio to load correctly on my PC.

Windows 7 Environmental variables dialog

Windows 7 Environmental variables dialog.

Note: This post assumes that the current Java version has been installed on the users machine. I’m posting this as much as a reminder to myself for future reference. I hope you find it of some use reader. I expect if I get time I will will be adding to the ‘Memory Jogger’ Posts over the next few months as I try to get up to speed with Android Studio again. I barely got out of ‘Eclipse’ mode before I had to put this Android work away.