Thursday, August 4, 2022

[Solved] Error: could not open 'C:\Java\jre8\lib\amd64\jvm.cfg'

Hello guys, if you are getting "Error: could not open 'C:\Java\jre8\lib\amd64\jvm.cfg'" error or just Error: could not open 'jvm.cfg and wondering what to do and how to solve this error then you have come to the right place. I will show you how I solved this error and how you can use my tips to solve your error as well. 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 a Java installation problem, so I went to the 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 the 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.


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 the 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'.


Error: could not open 'C:\Program Files\Java\jre8\lib\amd64\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 Eclipse, but you can also see this with any other Java application like IntelliJIDEA, NetBeans or Minecraft.


Related troubleshooting guides
Here are some handy Java tips to solve some common errors 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 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 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 fix java.lang.OutOfMemoryError: Java Heap Space in Eclipse, Tomcat? (solution

59 comments:

  1. Replies
    1. @Khusbhu, Glad to know that this tip helped you :-)

      Delete
  2. Did not work for me, I'm on Windows 8 and my message says the same as yours.

    ReplyDelete
    Replies
    1. did you find a fix? This solution did not fix my problem either.

      Delete
  3. Thanks man .. It worked for me

    ReplyDelete
  4. I 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

    ReplyDelete
    Replies
    1. Hello @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

      Delete
  5. And if we can't be able to found the java.exe and others in the system32 folder

    ReplyDelete
    Replies
    1. @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
    2. I found that 3 files in jdk's bin folder.. but i am not getting where to paste it?

      Delete
  6. ...and when you dont have the Java folder in System32? Coz that's my case.
    Looks like I installed a 32bit on a 64bit machine. Gonna try to download the other and try again.

    ReplyDelete
    Replies
    1. 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.

      Delete
    2. Error: could not open `C:\Program Files\Java\jre1.6.0_03\lib\i386\jvm.cfg'

      Delete
  7. In 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.

    ReplyDelete
    Replies
    1. Are your machine 64-bit? is there any other System folder where you can see those files?

      Delete
  8. In 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.

    ReplyDelete
    Replies
    1. Did 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.

      Delete
    2. I searched the folder in all possible places, and I put it in the windows explorer search engine, and that folder doesn't appear, my system is 64 bits and I don't know what to do

      Delete
    3. Exactly same issue as Jerid for me. Still doesn't work

      Delete
  9. Bro i am still facing the problem.I rum windows 10,64 bit.please help

    ReplyDelete
  10. i havent noticed any such file in system32 as java.exe,javaws.exe

    ReplyDelete
  11. there are no such files in system32 folder , mine is windows 10 and i installed 64-bit only plz help .

    ReplyDelete
    Replies
    1. Hi, what error you are getting? for Windows 10 and 64-bit, see if there is a folder called C:\Windows\System64 or something? If you can post error, I may be able to suggest you better?

      Delete
    2. Hello everyone you can find those three java folders in program Files(86) \common Files\oracle\java\javapath

      Delete
    3. After removing those files, now I am getting below error.
      'java' is not recognized as an internal or external command,
      operable program or batch file.

      Delete
    4. Check your PATH and add your JAVA_HOME/bin directory into PATH. JAVA_HOME is the directory where you installed Java.

      Delete
  12. not able to solve the problem.i didnt get any java files in system32 and i went through all the comments here but not even single comment is helping me.i have searched in all folders but i didnt get it.

    ReplyDelete
    Replies
    1. Hi, what error you are getting? for Windows 10 and 64-bit, see if there is a folder called C:\Windows\System64 or something? If you can post error, I may be able to suggest you better?

      Delete
  13. there are no such files in system32 folder ,
    and i installed 64-bit only plz help

    ReplyDelete
    Replies
    1. hmm, not sure, need to look into it, is there a similar folder like system64, may be check there.

      Delete
  14. Please help in my C: windows\system32 there is no java or any java exe file so how can I solve this error

    "C:\prgram Files\Java\jre1.8.0_211\lib\amd64\jvm.cfg"

    ReplyDelete
    Replies
    1. Just copy java.exe and other exce files from JRE/bin or JDK/bin folder into System32

      Delete
  15. Hi, I am facing this error
    Error: could not open `C:\Program Files\Java\jre1.8.0_131\lib\amd64\jvm.cfg'
    I have copied all exe files (javap,javac.java,javaw,javadoc) from jdk to system 32 but the problem still exists. I am not able to find javaws.exe.

    ReplyDelete
    Replies
    1. Hello Anonymous, what are you trying to do? are you tring to compile Java code, running a JAR file or something else? Can you also check if JDK is in PATH or not? `C:\Program Files\Java\jre1.8.0_131\lib\amd64\jvm.cfg' points to JRE not JDK, if not, try adding JDK bin directory to PATH.

      Delete
  16. Hello Javin,
    I removed all the 3 java.exe,javaaws.exe and javaaw.exe but when I am running the script it is prompting to choose a program and if I choose java it is automatically getting terminated.please help me.

    ReplyDelete
  17. Hello javin,
    I removed java.exe,javaaw.exe and javaaws.exe but when I run the script it is prompting to choose a program and when I choose java ,the script is terminating automatically.please help me in this.

    ReplyDelete
    Replies
    1. Hello @Unknown, can yo provide more details, did you deleted from both System32 and Systemd64 folder (not sure what they call in 64 bit ) but basically check where does the Java is getting picked up first?

      Delete
  18. Error:could not open 'D:\s\lib\amd64\jvm.cfg
    And java folder create in System32

    ReplyDelete
  19. in my case i wont found anything in system32 folder

    ReplyDelete
    Replies
    1. Are you running on 64-bit machine or laptop? how about checking the System folder?

      Delete
  20. The above one did not work for me but rather searching for javaws in complete folder worked for me , i search all occurrence of java using search tool, the file was present at C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_xyz

    ReplyDelete
    Replies
    1. Thx for sharing your solution.

      Delete
    2. i also didnt had java folder in system32, i found the 3 files at C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_xyz and removed them. It solved the problem for me! Thanks.

      Delete
  21. Works. Thank you very much :)

    ReplyDelete
  22. works! Thank you............

    ReplyDelete

Feel free to comment, ask questions if you have any doubt.