Android Studio error: "Environment variable does not point to a valid JVM installation"
Asked Answered
F

22

23

When trying to run Android Studio on my computer, I get the following error:

The Environment variable JAVA_HOME (with a value of C:\Program Files(x86)\Java\jdk1.7.0_51\bin) does not point to a valid JVM installation

I tried to remove the \bin extension on my JAVA_HOME environment variable, but it gives me the following error:

No JVM Found. Please install a 64-bit JDK. If you already have a JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings > Environment Variables

  • My System: Windows 8.1 Update 1 x64 (64 bit)
  • Java Directory: C:\Program Files (x86)\Java\jdk1.7.0_51\bin
Fiore answered 20/4, 2014 at 17:16 Comment(0)
D
27

Do step by step as shown in this YouTube Video

Go to: System -> Advanced system settings -> Environment Variables

Add a new variable to you profile NAME=JAVA_HOME STRING: Program Files/java/"your string" Save and Start Android Studio ;)

enter image description here

Diphenylhydantoin answered 20/4, 2014 at 19:44 Comment(5)
@edthethird, you are wrong. I installed only java8. However I'm compiling android project with java7. Android supoorts java7 except try-catch resources.Boyhood
yeah, they added support for java 7 many months ago, this answer is outdated.Diphenylhydantoin
This is not a solution. The time does not stand still. Oracle doesn´t develop bug fixes for older versions.Grettagreuze
they also added support for java7 since I made this post. At the time, you could only use java6Diphenylhydantoin
Yes this is one hack.Minded
B
42

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.

Boyhood answered 2/9, 2014 at 12:0 Comment(0)
D
27

Do step by step as shown in this YouTube Video

Go to: System -> Advanced system settings -> Environment Variables

Add a new variable to you profile NAME=JAVA_HOME STRING: Program Files/java/"your string" Save and Start Android Studio ;)

enter image description here

Diphenylhydantoin answered 20/4, 2014 at 19:44 Comment(5)
@edthethird, you are wrong. I installed only java8. However I'm compiling android project with java7. Android supoorts java7 except try-catch resources.Boyhood
yeah, they added support for java 7 many months ago, this answer is outdated.Diphenylhydantoin
This is not a solution. The time does not stand still. Oracle doesn´t develop bug fixes for older versions.Grettagreuze
they also added support for java7 since I made this post. At the time, you could only use java6Diphenylhydantoin
Yes this is one hack.Minded
C
24

All you need to do is, set the JAVA_HOME and JDK_HOME environment variables by following the steps:

1)Right click on

My Computer.->>Properties->>Advanced System Settings.->>Environment Variables

.

2)In user variables for (Your PC name),click on new at botton of the tab.

3)In variable name,type JAVA_HOME

4)In variable value,type

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

(path where your jdk folder is located on the system ).

5)Do it again with JDK_HOME

with same path.

Commorancy answered 27/10, 2014 at 10:43 Comment(0)
C
17

Providing both JAVA_HOME and JDK_HOME with identical Path without \bin helped for me! My settings:

  • JAVA_HOME

\Program Files\Java\jdk1.8.0_05

  • JDK_HOME

%JAVA_HOME%

  • PATH

...%JAVA_HOME%\bin

Christine answered 9/12, 2014 at 21:9 Comment(0)
S
12

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

JAVA_HOME should be with value C:\Program Files(x86)\Java\jdk1.7.0_51

Subsidize answered 10/4, 2015 at 6:56 Comment(0)
F
7

To solve this, add the JAVA_HOME variable in Users variables instead of System variables.

Install 64 bit JDK and JRE if you have a 64-bit computer and set the JAVA_HOME variable like in the picture

https://www.dropbox.com/sh/4ysuelcz00rphxk/AABwQPXql1b2ciWQDSJjkcT2a?dl=0

Fresh answered 23/1, 2015 at 9:12 Comment(0)
M
5

In my case, I had the whole variable for JAVA_HOME in quotes. I just had to remove the quotes and then it worked fine.

Mikkimiko answered 26/8, 2015 at 23:42 Comment(1)
This was driving me crazy. 32 bit version works with and without quotes, 64 bit works only without.Aruwimi
T
2

If you start 64bit Android Studio, you have to add in User Variable as

"JAVA_HOME"
"C:\Program Files\Java\jdk1.8.0_31"

If 32bit

"JAVA_HOME"
"C:\Program Files\Java\jdk1.8.0_31"

and don't put \bin end

then comes to system variable

select and edit "path" as

"C:\Program Files\Java\jdk1.8.0_31\bin"

here u should must put " bin; " at end also put ; together.....Okey do it

Thornie answered 26/1, 2015 at 7:54 Comment(0)
A
2

Just set the Environment variable to JAVA_HOME of

C:\Program Files\Java\jdk1.7.0_51)

with out bin for 64 bit version and same for 32 bit version with Program Files(x86).

NO \BIN after the path it will work properly.

Anus answered 31/1, 2015 at 13:10 Comment(0)
D
2

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,

Downloaded 32 bit JDK(you can also download 64 bit Android Studio if you do not want to change the 64 bit JDK) 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. Save it and launch Android Studio. You are good to go now.

Dorcia answered 19/4, 2016 at 3:40 Comment(1)
The fact that my installation was in Program Files, no x86 proves I have 64 bit Java.Fiore
E
1

You have a problem with your Java JDK installation. So, try reinstalling it. You can download it from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

It looks that you have a 64-bit system, so download the "Windows x64" version.

Ellon answered 20/4, 2014 at 17:22 Comment(14)
Whats your JDK installation directory.Ellon
Should I reboot, if not, the suggestion did not work. I will anyways.Fiore
Can you tell me your JDK installation directory.Ellon
Sure... C:\Program Files (x86)\Java\jdk1.7.0_51\binFiore
Does your bin folder has the jvisualvm.exe the file.Ellon
Yes, my java bin folder does have that executable.Fiore
Oh, I just noticed that your Program files name is "Program Files(x86)", so you should check again whether your windows is 64-bit or 86-bit and then check the JDK for the same. If both match, then I think you have no choice other than reinstalling the Android SDK and the Java JDK.Ellon
Ok, so they are the same, so I have to install both again, and in what order? JDK first?Fiore
Sorry, I mistyped, I meant if they don't match. But, then also you may try reinstalling that must fix your problem (90% chance).Ellon
Should the Android Studio install to Program Files or Program Files (x86)?Fiore
Leave the installation directory to default.Ellon
Ok, Same error (The Environment variable JAVA_HOME (with a value of C:\Program Files(x86)\Java\jdk1.7.0_51\bin)) does not point to a valid JVM instalation). What should I do?Fiore
I can give you a last advice of checking your JDK by opening the jvisualvm.exe or installing a program like BlueJ to check whether your JDK is corrupt or not.Ellon
jvisualvm.exe works otherwise, I'm not sure. Problem Still unsolvedFiore
S
1

The answer to this question can be found here

goto the AndroidStudio installation folder.
goto bin folder and open studio.bat in text editor
add set JAVA_HOME=C:\Program Files\Java2\jdk1.8.0//your java path after the ECHO line.
goto Start -> All Programmes -> Android Studio ->
right click on Android Studio and click on properties.
You will see the Target something like <installation path>android-studio\bin\studio64.exe
change it to <installation path>android-studio\bin\studio.bat

or..... even this might work

Java_Home path set to its parent folder to C:\Program Files\Java\jdk1.8.0_25

Sos answered 4/2, 2015 at 13:32 Comment(0)
A
1

I had Windows 64bits, but my SDK was 32bits. No changes in the variables were needed, to solve my problem:

Instead of open

C:\Program Files\Android\Android Studio\bin\studio64.exe

I used

C:\Program Files\Android\Android Studio\bin\studio.exe

Algin answered 21/9, 2015 at 4:40 Comment(0)
P
0

Adding the following path without back slash '\' at the end worked for me. C:\Program Files\Java\jdk1.8.0_31

Phillisphilly answered 30/1, 2015 at 6:26 Comment(0)
D
0

I solved this problem by making sure that the value of JAVA_HOME was the folder location in English

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

rather than the folder location that one can see/explorer browse in my Windows7 - Portuguese installation

C:\Programas\Java\jdk1.8.0_31

Discover answered 2/2, 2015 at 17:6 Comment(0)
D
0

In response to:

Ok, Same error (The Environment variable JAVA_HOME (with a value of C:\Program Files(x86)\Java\jdk1.7.0_51\bin)) does not point to a

valid JVM instalation). What should I do? – IPconfigrammer Apr 20 '14 at 18:41

      I can give you a last advice of checking your JDK by opening the jvisualvm.exe or installing a program like BlueJ to check whether

your JDK is corrupt or not. – prakhar19 Apr 20 '14 at 18:45

      jvisualvm.exe works otherwise, I'm not sure. Problem Still unsolved –  IPconfigrammer

IPconfigrammer --I've been having the same problems. After trying just about everything on this page, I noticed when Android Studio was telling me it wasn't valid it asked me to install a 64-bit JDK. So, even though my windows is 86-bit, I downloaded the 64-bit JDK and, without changing any environment variables or anything, I've just opened Android Studio for the first time. No more errors. :)

So try the 64-bit instead of the 86-bit.

Dian answered 24/2, 2015 at 14:59 Comment(0)
H
0

In my case, the problem was that a line feed had gotten into the setting of the JAVA_HOME variable. I'm not sure how, but I was mucking with it earlier because I had had an issue with an unrelated ant build that was using JAVA_HOME, and I copied the path in.

I noticed the problem partially when I did a "set" command from the command line, and it showed "JAVA_HOME" on one line and the path on the next line, and a blank line after it.

But what really helped was running the gradle command. It gave the same error message. That gave me confidence that the problem really was the JAVA_HOME variable, and not the Android Studio install.

To solve the problem, I deleted the JAVA_HOME variable first. Then, when setting up the command to set the variable, I keyed in the path manually in Textpad, to make sure there were no linefeeds or carriage returns.

Then I ran the command:

setx JAVA_HOME "C:\Program Files\Java\jdk1.7.0_71"
Hibernia answered 3/5, 2015 at 20:28 Comment(0)
G
0

all u need to do that is set tJAVA_HOME and JDK_HOME environment variables paths for this go my computer properties set path with name JAVA_HOME and JDK_HOME C:\Program Files\Java\jdk1.8.0_25

enter image description here

Galateah answered 27/7, 2015 at 10:22 Comment(0)
H
0

I also had similar issue. Had correctly installed the application, had appropriately setup the JAVA_HOME, still it was not able to find the JDK and complains about the ver 1.6.0_17.

I no longer have any such version installed on my machine. After much digging I got onto the "HKEY_LOCAL_MACHINE\software\javasoft\Java Development Kit\" where I found multiple JDK version being mentioned.

I removed all except 1.8.0_25 that I currently have on my machine. Restarted the Android Studio, and it worked without any problem. May be someone visit this page, facing similar issue, might help.

Hester answered 8/10, 2015 at 15:13 Comment(0)
S
0

It started happening to me when I changed variables for Android Studio. Go to your studio64.exe.vmoptions file (located in c:\users\userName\.AndroidStudio{version}\ and comments the arguments.

Solferino answered 28/11, 2017 at 2:47 Comment(0)
R
0

I solved it as:

In my Windows 10 Machine (JDK & Android Studio both 64bit), in start menu I was having icon (shortcut) from somewhere else. When I was clicking Android Studio icon in Start Menu it shows me error. While going manually to installation folder of Android Studio: C:\Program Files\Android\Android Studio\bin When I clicked on studio64.exe instead of studio.exe it worked. Then I just made shortcut of studio64.exe, instead using studio.exe.

Other Settings:

Environment Variable:

JAVA_HOME

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

JDK_HOME

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

System Variable:

JAVA_HOME

C:\Program Files\Java\jdk1.8.0_60\bin;

JDK_HOME

C:\Program Files\Java\jdk1.8.0_60\bin;

Remember:

  • 64bit doesn't require you to enclose string with double quotes.
  • Also in User Variable you don't need to add \bin while System Variable you need to.
  • Also specify ; at the end on \bin in System Variable.
Recalesce answered 19/6, 2018 at 5:36 Comment(0)
G
0

There are two file in C:\Program Files\Android\Android Studio\bin. studio and studio64. I was running studio while my system is 64 bit. when I ran studio64 it worked. My system variable are

JAVA_HOME = C:\Program Files\Java\jdk-10.0.2;.;
JDK_HOME = C:\Program Files\Java\jdk-10.0.2;.;
PATH = C:\Program Files\Android\Android Studio\jre\jre\bin;.;
Gunner answered 14/2, 2019 at 19:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.