[java] Android Studio error: "Environment variable does not point to a valid JVM installation"

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

This question is related to java android jvm java-home

The answer is


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.


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.


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.


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;.;

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"

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


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


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


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


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.


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.

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


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


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.


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.


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


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.


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.


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.


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

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


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


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to jvm

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How can I get a random number in Kotlin? Kotlin unresolved reference in IntelliJ Is JVM ARGS '-Xms1024m -Xmx2048m' still useful in Java 8? Android Gradle Could not reserve enough space for object heap Android java.exe finished with non-zero exit value 1 Android Studio Gradle project "Unable to start the daemon process /initialization of VM" Android Studio - No JVM Installation found Android Studio error: "Environment variable does not point to a valid JVM installation" Installing Android Studio, does not point to a valid JVM installation error

Examples related to java-home

Set ANDROID_HOME environment variable in mac Error: JAVA_HOME is not defined correctly executing maven How to set JAVA_HOME in Linux for all users Android Studio error: "Environment variable does not point to a valid JVM installation" Installing Android Studio, does not point to a valid JVM installation error How can I change Mac OS's default Java VM returned from /usr/libexec/java_home How to set JAVA_HOME path on Ubuntu? Where is the Java SDK folder in my computer? Ubuntu 12.04 How to set JAVA_HOME in Mac permanently? How to set CATALINA_HOME variable in windows 7?