28

Having trouble firing up android studio. Get the following message: The environment variable JAVA_HOME (with the value of ?C:\Program Files\Java\jdk1.8.0_31) does not point to a valid JVM installation. The problem is that as far as I can tell, the environment variable I set up IS pointing to a valid install.

I've tried everything from renaming it to JDK_HOME, to pointing it to all the sub directories in the jdk folder, to uninstalling and reinstalling java and android studio about 3 time. I have triple checked that I have 64 bit JAVA installed (and that my computer is 64 bit). Pretty much at the end of my rope here. Help would be appreciated big time.

Here's a screen cap of my windows, you might spot something obvious I haven't:

a screen cap of my windows

Cœur
  • 37,241
  • 25
  • 195
  • 267
oneshotfinch
  • 289
  • 1
  • 3
  • 3
  • Look into the link below you have to change your jdk location in studio [1]: http://stackoverflow.com/a/20033812/4384828 – Sanjay Hirani Feb 05 '15 at 13:39
  • 3
    if you go to `File -> Other Setttings -> Default Project Structure` ... what do you see on JDK installation? – Claudio Redi Feb 05 '15 at 13:41
  • You have %JAVA_HOME%\bin in the "Path" variable?? Have you tryed with java 7?? – Alist3r Feb 05 '15 at 13:43
  • @Sanjay I've looked through that thread a couple of times now and I don't know what you're referring to. The jdk is in the right place because it's 64 bit. When you say I have to change it in Studio do you mean I have to edit Android Studio files? – oneshotfinch Feb 05 '15 at 13:53
  • have you tried user3232025 answer? – Sanjay Hirani Feb 05 '15 at 13:59
  • @ClaudioRedi Are you talking about Adnroid Studio? I can't launch it in the first place, I just get a window with the error message above. – oneshotfinch Feb 05 '15 at 13:59
  • @Sanjay This is weird... I can only see three answers, one from hichris123, one from Rahul Gupta and one from ejmin. Can't even find a user3232025 in any of the comments. Could you copy/paste what they said? EDIT: Just noticed he posted in this thread, whoops! Will try it now. – oneshotfinch Feb 05 '15 at 14:03

22 Answers22

29

You can try this Android Studio error: "Environment variable does not point to a valid JVM instalation"

this works for me. If you start 64bit Android Studio, you have to add JAVA_HOME as

"C:\Program Files\Java\jdk..."

If 32bit

"C:\Program Files(x86)\Java\jdk..."

and dont put "\bin" end of the path.

chaitanya
  • 1,726
  • 2
  • 17
  • 13
  • Make sure you don't actually type the quotation marks. Once I removed those, mine worked fine (win7x64). – shade4159 Sep 17 '15 at 19:50
13

As you told you have 64 bit system then copy this path C:\Program Files\Java\jdk1.8.0_31

Step 1 :- Create JAVA_HOME variable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.

Step 2 Then click path variable and edit then past it your path after add semicolon (;) C:\Program Files\Java\jdk1.8.0_31

enter image description here

I am using windows 10 so this windows look like this

enter image description here

Note :- If above dialog not open then , select path variable and click on Edit…. Locate the end of the current variable value append the path of jdk, using a semicolon And click ok

Arpit Patel
  • 7,212
  • 5
  • 56
  • 67
8

To fix it, just remove "\bin" from my JAVA_HOME variable.

NOTE: 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.

Hemant Ramphul
  • 565
  • 5
  • 8
6

If you are sure that the variable is pointing to the right place, then:

Acess "C:\Program Files\Android\Android Studio\bin"

Choice the .exe for your machine.

enter image description here

Marzi Heidari
  • 2,660
  • 4
  • 25
  • 57
5

Faced same problem for many weeks. What worked for me: uninstalled all java from laptop then installed jdk 7 64 bit, deleted JAVA_HOME and added JDK_HOME.

MRAgrawal
  • 123
  • 1
  • 10
4

To fix Android Studio - JAVA_HOME doesn't point to a valid JVM installation Problem, follow the below steps:

Step 1: Open the command window by typing ‘cmd‘ in the Start menu search box.

Step 2: Now change the directory to the Android studio installation :

cd "c:\Program Files (x86)\Android\android-studio\bin"

Step 3: Type ‘studio.bat‘ and hit enter. If the JAVA environment variables are not set properly, then you should get an error message as below.

enter image description here

Step 4: So, it is clear that Android studio is not able to read the JDK location. All you need to do is, set the JAVA_HOME and JDK_HOME environment variables by following the steps mentioned in this guide.

enter image description here enter image description here

Step 5: Close the existing command window. This step is very important, as the newly set variable will not reflect otherwise.

Step 6: Re-launch the command window and type the below command to ensure that the environment variables are set properly.

echo %JAVA_HOME%

echo %JDK_HOME% enter image description here

Step 7: Now change the directory to the Android studio installation.

cd "c:\Program Files (x86)\Android\android-studio\bin"

Step 8: Type ‘studio.bat‘ and hit enter. Now the Android studio will launch normally.

Based on these link : Google Android Studio is not launching?

Ahlem Jarrar
  • 1,129
  • 1
  • 12
  • 33
3

I use Windows 8.

2 steps:

  1. Download jdk-7u80-windows-x64.exe

    1.1 It's a requirement @ https://developer.android.com/sdk/index.html#Requirements

  2. Set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_80

NOTE: not in Program Files (x86)

Alex Filatov
  • 2,232
  • 3
  • 32
  • 39
2

Remember that you have to set the JAVA_HOME variable to C:\Program Files\Java\jdk1.8.0_31, just like you set the variable JDK_HOME. :)

See this post for reference: Android Studio installation on Windows 7 fails, no JDK found

Also, you could try installing an older version of java, as the newest ones might not be compatible with your IDE. Reference: Android Studio error: "Environment variable does not point to a valid JVM installation"

Community
  • 1
  • 1
Anfaje
  • 335
  • 4
  • 14
2

Ensure JAVA_HOME is in the "System Variables" and points to the JDK short path. For example if the JDK is C:\Program Files\Java\jdk1.7.0_79 set JAVA_HOME to C:\PROGRA~1\Java\JDK17~1.0_7 . I was getting the above error message initially upon install but it started working when I made this change, and it was not necessary to reboot.

SkyWalker
  • 28,384
  • 14
  • 74
  • 132
Fergus
  • 21
  • 1
2

make JAVA_HOME a system variable under environment variables and set it to C:\Program Files\Java\jdk1.8.0_31.

After that logout and login back. This should eliminate the error message that you are getting. Then launch the Android Studio.

SkyWalker
  • 28,384
  • 14
  • 74
  • 132
2

JAVA_HOME path : C:\Program Files\Java\jdk1.8.0_102\             //Copied from PATH variable.

Remove quotes if any.

If your system is 32 bit then execute studio.exe

If your system is 64 bit then simply execute studio64.exe

It solved my issue

Jasmeen
  • 876
  • 9
  • 16
2

I tried installing all the versions of JDK and changing the user environment variable. Only the following worked. Install the same versions and you are good to go.

  1. Android studio version is 2.1.2
  2. Install Java jdk1.8.0_91
  3. Add the following user environment variable JAVA_HOME C:\Program Files\Java\jdk1.8.0_91

enter image description here

Siddarth Kanted
  • 5,738
  • 1
  • 29
  • 20
1

in your system Variable ( path ) append this wilset the C:\Program Files\Java\jdk1.8.0_31

ashishgoel
  • 11
  • 2
  • I think you are trying to say that the correct path(e.g. `%JAVA_HOME%\bin`) containing the Java executable (e.g. `java.exe`) should be in the PATH environment variable as well, but the answer is quite unreadable right now. – Maarten Bodewes Feb 05 '15 at 14:18
1

In your case you just have to do the following:

 `Go to Control Panel> Advanced System Settings> Environment Variables
 > System Variables> New> Variable name: JDK_HOME
                          Variable value: C:\Program Files\Java\jdk1.8.0_31\

 and then click on android studio..It will start working.` 
androminor
  • 322
  • 1
  • 13
1

I am using windows 7 32-bit and this worked for me:

Added new system variable: JDK_HOME with correct location of my JDK:

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

Thomas Rollet
  • 1,573
  • 4
  • 19
  • 33
1

For this issue, I download the jdk oracle version 11 on the official java website, I then set the JAVA_HOME in the environment variable to the jdk path for both the user and system. It is important that it is jdk and not type jre. Hopefully this helps. Run the Android studio 64-bit type, if does not work try the 32-bit.

I found there is some issue if you download the wrong version of 32 or 64 bit version so be careful on that.

Victor
  • 11
  • 1
0

For me it got fixed when I removed the leading and trailing double quotes in the JAVA_HOME system environment variable (Windows 7 x64):

Did NOT work: "C:\path\to\jdk\without\bin"
Did work: C:\path\to\jdk\without\bin

Note:
I do not have any spaces in the path to the JDK (custom location)!

audacus
  • 3
  • 1
  • 4
0

Step 1) Download your version of jdk exe file and run it. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Step 2) Once installation is complete, you will see the jdk directory in Java folder in Program files under C Drive Step 3) Right click on my computer, then click on advance settings, then click on environment settings. Step 4) add a new variable called JAVA_HOME and set its path to PATH = C:\Program Files\Java\jdk1.8.0_31\ Step 5) Run Android Studio :)

JavaGeek
  • 475
  • 5
  • 14
0

FOR JAVA RELATED INSTALLATION THIS IS THE PATH SETTING ARE MATCHED N RUNS YOUR INSTALLATIONS SUCCESSFUL.

Step 1 :- Create JAVA_HOME variable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.

Step 2 Then click path variable and edit then past it your path after add semicolon (;) C:\Program Files\Java\jdk1.8.0_31

0

MY COMPUTER | RIGHT CLICK | PROPERTIES | ADVANCED SYSTEM SETTINGS | ADVANCED TAB | ENVIRONMENT VARIABLES | USER VARIABLES | NEW | VARIABLE NAME = JAVA_HOME VARIABLE VALUE = "C:\Program Files\Java\jdk1.8.0_131"

REMOVE BIN, IF YOU ADDED ALREADY...

Hi! It works for me...

Jaffar
  • 31
  • 5
0

We can also resolve this issue by using jdk 8 to install jdk 8 click here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmli and download jdk setup install it to copy the path go to c drive select programme file folder then choose java then choose jdk and you will see the version go to that folder and copy the path and right click on my computer go to properties then choose advance settings then you will see one pop pup in that you have to choose variables.and click on new tab and give the name of variable JAVA_HOME and in the path you need to past the path that you have copy for jdk 8 enter image description here

after that you have to click ok ok two times now start your android studio error will be resolved

bharat udasi
  • 133
  • 7
-1

Delete your all user variable paths from Environments Variable, and keep only two (TEMP & TMP) variables, it will work.