67

I just downloaded the Android Studio. While trying to run it, I had to modify the environment variable and add

JAVA_HOME

and

C:\Progra~2\Java\jdk1.6.0_22

Once I finished that hurdle, now I am receiving another error:

The environment variable JAVA_HOME (with the value of *C:\Progra~2\Java\jdk1.6.0_22*) does not point to a valid JVM installation.

I looked through other similar questions and I was asked to check the version, so I did the following in CMD:

C:\Users\Andre>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

C:\Users\Andre>javac -version
javac 1.6.0_22

From the results it seems like I have JVM.

I also tried these paths for JAVA_HOME, I closed and reopened a new CMD window each time

C:\Program Files (x86)\Java\jre7
C:\Program Files (x86)\Java\jre6
C:\Program Files (x86)\Java\jdk1.6.0_22
C:\Program Files (x86)\Java\jre7\bin
C:\Program Files (x86)\Java\jre6\bin
C:\Program Files (x86)\Java\jdk1.6.0_22\bin
Abdelrahman Wahdan
  • 2,056
  • 4
  • 36
  • 43
LegionDev
  • 1,391
  • 4
  • 15
  • 29
  • 1
    have you restarted your system after setting the JAVA_HOME ?? – Qadir Hussain Jan 14 '14 at 16:54
  • I really hope those 'GOOGLE ENGINEERS' developing on AS should at least make the IDE run and have us set the JDK ourselves. This is very annoying that it just blocks you from start. If that is not possible then have a GUI popup during loading that asks us for valid JDK env variable. I am perplexed why they missed out on this. This is unacceptable. So basic. – Neon Warge Jul 09 '16 at 11:11

18 Answers18

197

Point your JAVA_HOME variable to C:\Program Files\Java\jdk1.8.0_xx\ where "xx" is the update number (make sure this matches your actual directory name). Do not include bin\javaw.exe in the pathname.

NOTE: You can access the Environment Variables GUI from the CLI by entering rundll32 sysdm.cpl,EditEnvironmentVariables. Be sure to put the 'JAVA_HOME' path variable in the System variables rather than the user variables. If the path variable is in User the Android Studio will not find the path.

SterlingVix
  • 321
  • 6
  • 12
Edwin Mokami
  • 2,094
  • 2
  • 12
  • 4
  • 3
    Thanks, so the trick was to remove bin from the path, i did not try with bin\javaw.exe before. All the documentation tells you to include the bin folder... shame on them, well good tip :) – Lu Roman Aug 14 '14 at 03:24
  • 8
    For me it only worked when I used C:\Program Files\Java\jdk1.8.0_xx where "xx" is the update number without the \; at the end – dangalg Aug 23 '14 at 11:24
  • 2
    Also important: do not sourround the path in quotes "C:/Pro...". That might be obvious for some, but unfortunately not for me. – surt91 Oct 12 '14 at 12:51
  • 1
    Did require a boot too. – Arttu Oct 24 '14 at 17:39
  • 1
    For me its worked only after removing the semi colon ";" at the end of the path... – Sabeer Oct 28 '14 at 05:26
  • 4
    It shouldn't be the bin folder, but the root as pointed out in the answer! – Edeph Oct 28 '14 at 21:18
  • Oddly enough, it worked for me when I changed the user variable – Robert May 20 '15 at 10:22
  • This pointed towards the right direction. Also, I had to remove all the double quotes etc from the path and put it in system path – Aman Alam Jun 06 '15 at 09:10
  • In my case, I have to remove the bin folder from JAVA_HOME – Marcus Becker Oct 29 '15 at 22:02
53

It is absolutely possible that all other answers work for people but for me this path worked:

Leave your JDK path under JAVA_HOME System Variable as it is given here. Do not append bin or another path. It worked for me.

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

Otherwise I am getting this error:

Installing Android Studio, does not point to a valid JVM installation error
Master
  • 2,945
  • 5
  • 34
  • 65
28

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.

Vivek Ji
  • 117
  • 1
  • 7
PK Gupta
  • 822
  • 10
  • 20
21

2 suggested solutions

  1. Upgrade JDK to 1.7

  2. Make sure the 32-bit or 64 bit versions match on both sides

Abs
  • 3,902
  • 1
  • 31
  • 30
  • 9
    i had download 1.8 install it giving path to jdk1.8/bin now it giving me this error – CoronaPintu Jun 19 '14 at 05:48
  • 4
    with the version 1.8.0_25 i'm still getting the error! – Mill Feb 10 '15 at 01:20
  • Check it in your command line tool by typing "Java --version" – Seth Dec 16 '15 at 02:09
  • 4
    I also had the similar error with JDK 1.8 64 bit installed, i remove JAVA_HOME variable from environments and wrote JRE and JDK path in PATH variable C:\Program Files\Java\jre1.8.0_65\bin;C:\Program Files\Java\jdk1.8.0_65\bin, now android studio is working fine, it automatically picked up the JVM Path. hope this will help someone – rummykhan Dec 22 '15 at 17:01
14

Recently I am working with the 1.8.0_25 JDK version on Windows 8.1 and I had the same problem with this. But as PankaJ Jakhar said

The real solution for me was pretty simple:

  1. Add the JAVA_HOME variable to the system ones, not on the user ones.
  2. The path I introduced for this variable was:

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

And it works for me!

alexventuraio
  • 8,126
  • 2
  • 30
  • 35
10

In my case, it started hapenning after I updated to Android Studio 1.2. To fix it I just had to remove "\bin" from my JAVA_HOME variable.

Rodrigo Venancio
  • 1,284
  • 1
  • 12
  • 17
2

1) Just remove \bin from Java_home environmental Variable. This worked for me .
2) Also make sure you are using the correct versions of android studio and Java (32/64 bit)

2

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\

Kartik Goyal
  • 459
  • 3
  • 15
1

I am using 64-bit Windows. After battling with various settings I followed these steps:

  • Thru Add/Remove Programs I uninstalled all Java(s)
  • Removed JAVA_HOME variable from environment
  • Removed Java folder reference from PATH environment variable
  • Downloaded and installed 64-bit Java SDK
  • Added JAVA_HOME variable in system variables and assigned it the value C:\Program Files\Java\jdk1.8.0_31

In the last step please note that its the parent Folder and not the \bin sub-folder. It started working.

halfer
  • 19,824
  • 17
  • 99
  • 186
AnR
  • 1,809
  • 3
  • 26
  • 45
1

Don't include bin folder while coping the path for Java_home.

Rahul Sonone
  • 2,685
  • 1
  • 27
  • 38
1

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.

Jared Sanchez
  • 67
  • 1
  • 10
1

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

Kevan
  • 881
  • 1
  • 5
  • 12
1

Try using the above options But this one worked for me. my JAVA_HOME looked like this C:\Program Files\Java\jdk1.7.0_21;F:\Software\apache-ant-1.9.4-bin\apache-ant-1.9.4\bin Only keeping the JAVA path in the JAVA_HOME Remove any additional path if you had given C:\Program Files\Java\jdk1.7.0_21

Kaustubh Rao
  • 45
  • 1
  • 5
1

i think you are doing every thing fine just remove ";" from the last of java_home variable. every thing will work fine.

AMIT
  • 390
  • 1
  • 4
  • 17
1

Using c:/Program Files/Java/jre1.8.0_73/ instead of C:/Program Files/Java/jdk1.8.0_73 as JAVA_HOME variable solved the problem for me. Android studio now launches without problems.

manniL
  • 7,157
  • 7
  • 46
  • 72
Bbbartt
  • 71
  • 7
0

Follow @abs solution

If you still continue to get the error even after setting the JAVA_HOME variable Copy the studio folder to your C drive and then run the studio.exe or studio64.exe depending upon your java versio

Sagar Devanga
  • 2,815
  • 27
  • 30
0

In my case it was because of an invisible character at the beginning of the path:

enter image description here

Angelo Tricarico
  • 1,333
  • 1
  • 19
  • 36
0

Most probably the issue happens because of the incompatability of 32 bit and 64 bit excecutables. Suppose if you have installed 32 bit Android Studio by mistake and you will be downloading a 64 bit JDK. In this case 32 bit Android Studio will not be able to pick up the 64 bit JDK. This was the issue I faced. So I followed the below simple steps to make it working,

  1. Downloaded 32 bit JDK(you can also download 64 bit Android Studio if you do not want to change the 64 bit JDK)
  2. Right click MyComputer > Advanced System Settings > under 'Advanced tab' > Environment variables > Under System Variables > Add JAVA_HOME as key and your jdk(eg:C:\Program Files (x86)\Java\jdk1.7.0_79) location as value.
  3. Save it and launch Android Studio. You are good to go now.
dreamdeveloper
  • 1,266
  • 1
  • 15
  • 20