A couple of weeks back I updated my laptop to Windows 10 but after trying for one day, I reverted back to Windows 8.1. Everything was alright until I open Eclipse, which was throwing "Error: could not open 'C:\Program Files\Java\jre8\lib\amd64\jvm.cfg', as soon as I launch it. It was quite bizarre because everything was fine earlier. I suspect Java installation problem, so I went to command prompt and typed Java, only to find the same error there as well. You can see below, I am just trying to run the "java" command from MS-DOS window. Here "java" command is picked from PATH environment variable.
$ java
Error: could not open `C:\Program Files\Java\jre8\lib\amd64\jvm.cfg'
Then I checked my environment variables, JAVA_HOME and PATH and they all refer to C:\Program Files\Java. So this bit frustrating. After some time, I found that the default installation also copied java.exe, javaw.exe and javaws.exe to C:\Windows\System32 (i.e. uninstall of JRE didn't go well). I just removed them and voila, the error was gone. That annoying error is no longer popping.
If you are facing the same problem i.e. getting the Error: could not open 'C:\Java\jre7\lib\i386\jvm.cfg', then check your System32 folder and remove java.exe, javaw.exe, and javaws.exe if they exist there.
Here are the exact steps to solve could not open 'C:\Program Files\Java\jre8\lib\amd64\jvm.cfg' error:
1) Go to C:\Windows\System32
2) Search for Java in that folder
3) Remove java.exe, javaws.exe and javaw.exe from this folder
4) Open command prompt
5) Type Java it should work
Mind you, your error could be little different than mine depending upon whether your laptop is 32-bit or 64-bit. For example, if you are using 32-bit JVM then you can get something like Error: could not open 'C:\Java\jre7\lib\i386\jvm.cfg'.
That's all about how to fix this error: could not open 'C:\Program Files\Java\jre8\lib\amd64\jvm.cfg' in Windows 8 and Windows 10. I have got this with the Eclipse, but you can also see this with any other Java application e.g. NetBeans or Minecraft.
Further Learning
Complete Java Masterclass
Java Fundamentals: The Java Language
Java In-Depth: Become a Complete Java Engineer!
Related troubleshooting guides
Here are some handy Java tips to solve some common error and exception in Java:
$ java
Error: could not open `C:\Program Files\Java\jre8\lib\amd64\jvm.cfg'
Then I checked my environment variables, JAVA_HOME and PATH and they all refer to C:\Program Files\Java. So this bit frustrating. After some time, I found that the default installation also copied java.exe, javaw.exe and javaws.exe to C:\Windows\System32 (i.e. uninstall of JRE didn't go well). I just removed them and voila, the error was gone. That annoying error is no longer popping.
Error: could not open 'C:\Java\jre7\lib\i386\jvm.cfg' - Solution
If you are facing the same problem i.e. getting the Error: could not open 'C:\Java\jre7\lib\i386\jvm.cfg', then check your System32 folder and remove java.exe, javaw.exe, and javaws.exe if they exist there.
Here are the exact steps to solve could not open 'C:\Program Files\Java\jre8\lib\amd64\jvm.cfg' error:
1) Go to C:\Windows\System32
2) Search for Java in that folder
3) Remove java.exe, javaws.exe and javaw.exe from this folder
4) Open command prompt
5) Type Java it should work
Mind you, your error could be little different than mine depending upon whether your laptop is 32-bit or 64-bit. For example, if you are using 32-bit JVM then you can get something like Error: could not open 'C:\Java\jre7\lib\i386\jvm.cfg'.
That's all about how to fix this error: could not open 'C:\Program Files\Java\jre8\lib\amd64\jvm.cfg' in Windows 8 and Windows 10. I have got this with the Eclipse, but you can also see this with any other Java application e.g. NetBeans or Minecraft.
Further Learning
Complete Java Masterclass
Java Fundamentals: The Java Language
Java In-Depth: Become a Complete Java Engineer!
Related troubleshooting guides
Here are some handy Java tips to solve some common error and exception in Java:
- How to fix Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger (solution)
- How to solve "could not create the Java virtual machine" error in Java? (solution)
- Fixing java.lang.unsupportedclassversionerror unsupported major.minor version 50.0 (solution)
- How to avoid ConcurrentModificationException while looping over ArrayList in Java? (solution)
- How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error? (hint)
- How to fix java.lang.OutOfMemoryError: Direct Buffer Memory? (solution)
- How to solve java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver? (solution)
- java.lang.ClassNotFoundException : org.Springframework.Web.Context.ContextLoaderListener (solution)
- How to deal with java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject? (solution)
- Difference between NoClassDefFoundError and ClassNotFoundException? (answer)
- How to fix 'javac' is not recognized as an internal or external command (solution)
- java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory error (solution)
- How to solve java.lang.OutOfMemoryError: Java Heap Space in Eclipse, Tomcat? (solution)
- How to fix java.lang.OutOfMemoryError: Java Heap Space in Eclipse, Tomcat? (solution)
thanks!
ReplyDeleteWorked like a charm,Thanks Man
ReplyDelete@Khusbhu, Glad to know that this tip helped you :-)
DeleteDid not work for me, I'm on Windows 8 and my message says the same as yours.
ReplyDeletedid you find a fix? This solution did not fix my problem either.
DeleteThanks man .. It worked for me
ReplyDeleteWelcome Anonymous
DeleteI have same problem, i deleted these files from system32 and still doesn't work. I don't have any idea what should i do. Please help
ReplyDeleteHello @Anonymous, copy those file again from JAVA_HOME/bin director to the system32. The JAVA_HOME is the JDK installation directory, something like C:\Program Files\Java\jdk_xx
DeleteAnd if we can't be able to found the java.exe and others in the system32 folder
ReplyDelete@unknown, then you need to copy it from the JAVA_HOME or JDK's bin directory. You will always find the java.exe there.
Delete...and when you dont have the Java folder in System32? Coz that's my case.
ReplyDeleteLooks like I installed a 32bit on a 64bit machine. Gonna try to download the other and try again.
Hello Baryl, you don't need Java folder in System32, instead you just check if you have java.exe, javaw.exe etc there or not. If not, then copy it from your 32-bit or 64-bit JDK you have downloaded.
DeleteThanks. It Works
ReplyDeleteIn my system32 there were no java files, not even the java folder. I read the other comments and copied the 3 files into system32. Still, it doesn't work.
ReplyDeleteAre your machine 64-bit? is there any other System folder where you can see those files?
DeleteIn my system32 there were no java files, not even the java folder. I read the other comments and copied the 3 files into system32. Still, it doesn't work and my system is 64 bit.
ReplyDeleteDid your problem solved or you still facing the same issue? most likely it will be on some other folder, just search for those file using Windows Explorer search and you will find it.
DeleteBro i am still facing the problem.I rum windows 10,64 bit.please help
ReplyDelete