Android Studio, define a JAVA_HOME variable

Viewed 9872

I saw a video on Youtube for enhancing the performance of Android Studio. I did and now I can't launch my Android Studio. Now it gives an error saying that "If you already have a 64-bit JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings Environment Variables. Failed to create JVM. JVM Path C:\Program Files\Android\Android Studio\jre\jre"

enter image description here

I searched the whole internet and tried every solution mentioned but I still get the "define JAVA_HOME variable" error. I tried both completely uninstalling the Android Studio with all files and related folders manually deleted but still get this error and Android Studio just won't simply run. I have exams in a few days and I have a lot to practice.

Edit:

enter image description here

I just removed the JAVA_HOME. I have both the JDK and JVM installed. I am just uninstalling and installing Android Studio at the moment.

Edit 2:

enter image description here

4 Answers

Okay, so I found an answer after spending 5 hours fixing\setting Environment Variables (JAVA_HOME), uninstalling and reinstalling both the JDK and Android Studio.

The answer was simple. For any version of Android Studio that is >version 4.0, you need to remove the "studio.exe.vmoptions" or "studio64.exe.vmoptions" (depending on your system) from the directory "C:\Users{Your Username}\AppData\Roaming\Google{Android Studio Version}".

Did you tried to remove Java_Home? Java_Home Then try to start Android Studio. If there is still error, Try to uninstall JDK from programs.

It would be nice if you share some screenshots of "Environment Variables".

Did you tried all from here ? Problems setting the JAVA_HOME variable

This happens to me when updating android studio to version 4.2.1 and I try to solve it using Isaac answer suggestion but I don't find these files the solution which works with me is writing set JAVA_HOME=C:\Program Files\Android\Android Studio\jre in the Windows terminal and here the alternative commands for other operating systems

Try this. Create JAVA_HOME and enter the value or your bin directory.

Try This

Related