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"
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:
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:
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.
I recently decided to start trying Android app development, so I downloaded the Java SE Development Kit 8 (x86) for Windows (I got Windows 8 64bit, but my guide recommends getting the 32bit one), the Android SDK, and the Eclipse IDE for Java Developers (x86).
However, my Eclipse won't launch when I double click eclipse.exe! Instead, I get the following error message:
I tried adding Java to my Path variable in my Environment variables as suggested in some of the solutions I looked up, but it still doesn't launch properly.
Anyone know what else I can try? Also, if possible, please do not use super-technical vocabulary as I'm new to these kinds of stuff and will not understand you...thank you haha :D
I had the same issue and was trying to install different versions of JDK: 1.6, 1.7, 1.8.
It didn't help much.
The problem was resolved when I changed PATH variable by removing
C:\ProgramData\Oracle\Java\javapath;
In command prompt I also ran following commands:
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25
set PATH=C:\Program Files\Java\jdk1.8.0_25\bin;%PATH%
But I think the most important was to remove C:\ProgramData\Oracle\Java\javapath; from the PATH.
I know exactly how to solve your problem. Go to search and put in environment, a prompt will come up and ask you to "Edit environmental variables for your account" click that and a window will pop up. There will be the current paths which are running on the top (you should have your JDK version running, mine is 1.8) and on the bottom part there will be paths to choose from. Select (on the bottom part) the java path and delete it, then click okay. This should work.
If it didn't work, You may also add a new path to the java bin folder which worked for me.
Here is an alternative:
As described here, make sure that you have the -vm option set in your eclipse.ini file.
It must be an absolute path and on 2 separate lines:
-vm
<Absolute Path>\javaw.exe
Save your .ini and relaunch Eclipse
One line answer, remove 'C:\ProgramData\Oracle\Java\javapath;' from your path variable. It will start to work.
Most errors with starting eclipse happen due to multiple JRE or JDK version which makes the installer go nuts.
Solution: Go to Control Panel -> Uninstall Programs
If you're running 64-bit java, then uninstall all Java without the 64bit indicator. If 32-bit, then uninstall all that have 64-bit
It works like magic!
What worked for me was having installed adoptopenjdk11 using Chocolatey package manager:
choco install adoptopenjdk11
I have IntelliJ IDEA and other JetBrains products installed and they worked great (PyCharm, Android Studio, Clion, WebStorm) till today, now I just get opening message:
Error launching Intellij Platform - Error invoking main method
I have installed:
C:\Program Files\Java\jdk1.8.0_25
C:\Program Files\Java\jre1.8.0_25
and JAVA_HOME is pointing to jdk.
I posted at: https://devnet.jetbrains.com/message/5533036#5533036 and https://devnet.jetbrains.com/thread/459951
I installed (clean) Windows 8.1 and now it works, but there should be option to wipe all java configs from Windows to avoid such mess, cause this is not the solution.
I meet this error today. Java update message jump out when I work with AndroidStudio. I accept it but my AS can't display res files after installation. I restart AS and see the error.
I guess new version java produce the error. The updated java part is jre, version is 1.8.0_101, but jdk's version is still 1.8.0_92. So I download and install new version jdk(1.8.0_101, the same as jre).
AndroidStudio successfully starts now.
Maybe this solution can also work to IDEA.
For people who couldn't solve it by having the same version of JDK and JRE.
Uninstall IntelliJ and also clean all the files that are not swept automatically by uninstalling. you can find them in C:\Users\Usuario\AppData on Local and LocalLow find the JetBrains folder and delete all the files related to IntelliJ.
Then proceed to reinstalling it. That solved it for me.
Can anyone please tell me why I get the following error when I try to run my Java programs? The programs get compiled successfully but are not able to be run. I have already set the path of Java.
C:\JavaServ>javac hello1.java
C:\JavaServ>java hello1
Error: could not open C:\Program Files\Java\jre6\lib\amd64\jvm.cfg
Don't think if this is a correct way...(perhaps proper installation of Java is a permanent solution)....but this is a trick..:)
Delete the “java.exe” file from “c:\windows” and “c:\windows\system32″. That should fix it.
In case you get here and scroll this far down, the newer Oracle versions of Java x86 and probably also x64 are horribly broken. You may find that after removing all versions of Java, and even manually deleting all the versions you find in c:/program files/ and c:/program files (x86)/ that you still can't properly run a fresh install of Java.
I'm here to tell you why, and how to fix it.
Go to C:\Program Files\Common Files\ and DELETE the Oracle directory. It has a version of Java underneath it inside a junction (symlink) that is sequestered away from all your other installs. Bastards.
Now, also go to System Properties -> Advanced -> Environment Variables and edit the PATH under System Variables. Find the place where the Oracle folder is referenced, and delete it. Close all your windows down, reboot to be extra sure if you want.
Install the JRE or JDK. Open a command prompt and type 'java' and if it comes up, you're golden. If not, go back to the PATH variable and add "C:\Program Files (x86)\Java\jdk1.8.0_221\bin" or whatever looks right for your machine.
I hate Oracle.
this should be an internal file of JRE and in general you shouldn't deal with it when you're running/compiling java.
Here you can find an explanation of what exactly this file is intended for.
Bottom line, your Java installation is somehow corrupted, so as a first resort to resolve this issue, I suggest you to re-install jre.
You should ensure that you're installing the right jre for your architecture.
Hope, this helps
You can not Uninstall/Reinstall JRE if you are having this error.
That's why because previous installation has copied 3 files namely Java.exe, Javaw.exe, javaws.exe in the c:/windows/system32 folder.
Simply go there and remove these files and download a fresh version of jre from oracle and install it. I will prefer JDK 1.6 update 45. Which is very stable.
update registry path to installation location
This happened for me when I moved out my default installation from an overcrowded primary partition to another location. Fir
Java mysteriously broke on my work PC after a security patch was pushed out to us, giving this error whenever you tried to run a Java program. Somehow the 'lib' subdirectory of the Java 7 install had vanished! It might have been related to having multiple Java versions installed simultaneously.
If you're getting this error there are basically two things that could be wrong:
1) Your Java installation is broken. If the file/directory it's complaining about doesn't exist, uninstall and reinstall the JRE and then it should be there. This fixed it for me.
2) If the files are there, your PATH is somehow incorrect or pointing at an old/broken Java install. In this case you either need to fix your PATH to point to the correct java.exe/javaw.exe, or use a fully qualified path. So instead of:
java <whatever>
Use
c:\<full path to correct JRE>\bin\java.exe <whatever>
3) If your PATH is correct and files are there and it's still failing, the path could be getting truncated because it is too long. see: Running Java gives "Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'" .
i also had the same issue due to one more instance of java,javaw and javaws in C:\Windows\System32 which was pointing to jre6 and my default location of jre was pointing to this(C:\Windows\System32) location. Even having jdk 1.8 as my JAVA_HOME location i were getting this problem.
so either remove or rename java,javaw and javaws it will work.
If you have installer deployed Java on Windows and decided to bring some order to your JDKs with folders moving...
All answers with java.exe in Windows\System32 are right but in more tough situation - there are no files, but error messages still happen, then remember about Windows Registry entries (look regedit.exe).
They store information about JRE folder in this registry key:
win32:
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
win64:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment
The program can be compiled but while running it leads to such an error:
Could not open C:\Program Files\Java\jre6\lib\amd64\jvm.cfg
It indicates that the jvm.cfg file is missing in Program files. Reasons may be file corruption or file may be deleted. Install JRE again in "Program Files" folder.
Another case which happened with me is that I installed 32 bit jdk & jre in my 64 bit system in Program Files(x86) and my Program Files folder was empty. That was the reason for that error. So I installed 64 bit JRE in Program Files folder and it started to work. Note that it is not related to jdk version. Associated with only JRE problem.
I was getting the same error with my docear program on windows 7.
What I found is that I had two instances of java 1.6 installed on my computer. One instance has a jvm.cfg and the other does not.
Modifying my path to search the correct instance of java (in bold) first fixed the problem.
Here is my corrected path:
C:\Users\kranjit>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files\Java\jre6\bin;C:\Program Files (x86)\Java\jre6\bin;
In our system, for "java(jre)" for runtime purpose is availed, So If you install any different version of java, propbably the version before the one which is already installed.
E.g.; my windows 8.1 I have runtime java version of 8, then when I install Ver7 it is bu default taking V8, yet I uninstall 8, In this kind of Scenarios, Removing java.exe from c:\windows\system32 makes my java runtime work
For anyone still having an issue I made mine work by doing this probably not the best fix but it worked for me..
I uninstalled all Java's that i current had installed, reinstalled the latest one and changed the install directory to C:/Windows/jre (Basically where it kept saying there was no config file)
If you have installed more than one jdk version , uninstall the others and keep only the one in use. this worked for me.
https://www.java.com/en/download/help/uninstall_java.xml
I want to add some pointers here.
Whenever you face the error saying Could not open jvm.cfg, it means that there was some mess happened with java installation path. Below approaches might help.
If java is added in environment path, then open command prompt and type where java. If you get list of directories where java path specified. Other than the directory where you need the java file, delete the java files in all other directories.
If you are reading 2nd pointer, then 1st pointer might have not helped. Type regedit in run dialog and under HKEY_LOCAL_MACHINE, go to softwares/javasoft and rename the paths of the java installed directory.
Let me know if above approaches solve the problem.
The simple Solution is just uninstall the javaSE and reinstall it to the default location.
Then copy the installed location probably like C:\Program Files\Java\jdk1.8.0_131\bin.
After then go to desktop then while selecting right click on My Pc or This pc shortcut the under that select properties >> Advanced system settings >> under Advance tab >> last option Environment Variables..>>path >> edit >> past >> ;(not required if win10)/(required if windows 7)
I had this issue when installing 201, somehow it didn't uninstall my 191 properly. I had to go to the Program Files/Java folder, rename the old 201 directory, then install a fresh copy of 201. When doing so, it prompted me to uninstall 191, which I did. Now it's working fine.
I was facing the same issue after upgrading my java version.I had more than one jdk installation. I have manually uninstalled the old jdk version . Then it worked for me.
Resolved
I had similar issue, I tried different things but nothing worked. Then when I checked the installed programs. I could see two versions of java installed.
What I did is, just uninstall all java versions and freshly installed the required version. But this didn't seem to work when I checked in terminal. Then I had to reopen the terminal and run the command, then only it worked.
Note : Dont forget to reopen the terminal if you are testing via terminal.
I had an identical error trying to start IntellJ with a custom JBR.
C:\Users\user>"C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.3\bin\idea.bat"
Error: could not open `C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.3\jbr-arm64\lib\jvm.cfg'
This issue may occur if there were problems extracting Java or OpenJDK from a zip or tarball (e.g. a slow extraction was terminated prematurely) or if the zip or tarball was corrupted or incomplete.
If caused by a corrupted zip or tarball, try redownloading the archive.
If caused by a bad extraction, repeating the extraction will fix this.
Copying and pasting i386\jvm.cfg from a different PC will resolve the issue.
I had the same issue.I just uninstalled Java and reinstalled again it worked fine after that . The problem is related to JRE so you can just reinstall JRE.
I had same problem - when I tried to run a Java program from command line the error message appeared: "Error: could not open jvm.cfg".
My Path environment variable included following path:
C:\ProgramData\Oracle\Java\javapath
In the folder there were 3 exe files:
java.exe
javaw.exe
javaws.exe
When I removed the the entry
C:\ProgramData\Oracle\Java\javapath
from the Path environment variable and restarted cmd, I could run the program as usual (java MyProg).
Obviously I have corrupted the path pointing to correct java jre installation
C:\Program Files\Java\jre1.8.0_151
somehow previously when I played with my settings.
It means that this jvm.cfg file is not found. Maybe it was deleted. Reinstall the program. If you have this problem with a game for example, reinstall Java in the games folder, or copy Java files .de c:/Program Files/JAVA and paste to the JAVA folder in the game folder
I went to the Oracle site, downloaded and installed Java Platform (JDK) 7 on a Windows 7 64 bit virtual machine. I added the path to the c:\program files\Java\jdk1.7.0\bin to the path environment variable. I even deleted c:\windows\system32\Java.exe as recommended by someone. I was essentially following this: "Android Create" call fails in windows 7 - missing JDK
When I install the ADT it gives me the error JDK could not be found. Download the latest JDK. Why?
Thanks.
this is caused because the Android DK finds java in the c:\windows\system32\ folder before it finds the JDK one.
To resolve this edit your PATH environment variable and put the JDK path before the c:\windows\system32\ path.
Just in the ADT installer , press back when the installer promite for No JDK Found then press next, the installer will find the JDK, for sure this is a common bug
Does that happen when you open eclipse?
I'm thinking in two possible problems. Here is one possible solution: Eclipse - no Java (JRE) / (JDK) ... no virtual machine
If you already got this, go to Window -> Android SDK and AVD preferences
The first "preference" should ask you your Android SDK folder. you need to set this correctly.
Your JDK installation is not proper.
Reinstall JDK. It should be working fine.
I also had this problem once. I have done the above to resolve this issue.
You should not delete C:\Windows\System32 folder for this issue, It might lead to OS problems.
adil's answer is the one which finally worked for me (although I had added the jdk\bin to the path and created\set the JAVA_HOME to the same); moving the jdk\din directory before the win\sys32 in the PATH finally allowed me to install the android sdk on win7/64bit