Skip to main content

Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'

In some cases where you are playing around with your JDK/JRE its possible you corrupt your settings or JRE in total. I personally dont like the default JRE installation location on windows i.e. C:\Program Files\ for the fact that there is a space between Program and Files which at times create problems especially when you are using cygwin and writing some linux script. So as a regular practice I always install my JDK/JRE to c:\java. So the other day I got this brand new Windows 7 64bit machine with 8gb RAM and 3.3ghz i5 processor. My system admin was so kind enough that he gave me all the *required* tools already installed for my development. This obviously came with JRE 6 installed in Program Files directory. So I just un-installed it, got new 64bit JDK and JRE from Oracle and installed it under my regular directory i.e. c:\java. Now when I turned to my cygwin terminal and ran java what I see is below mentioned error

Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'


I checked my environment variables - JAVA_HOMEPATH and they all refer to c:\java. So this was bit frustrating. After sometime I found that the default installation also copied java.exejavaw.exe and javaws.exe to C:\Windows\System32 (i.e. uninstall of JRE didnt went well). I just removed them and voila, I'm back on track. That annoying error is no longer popping.

Cheers !!!
- Jay

Comments

  1. Thanks! This helped me as well to remove the error. I also found java.exe, javaw.exe and javaws.eve in C:\Windows\SysWOW64.
    Once I had removed these as well then I no longer received the error.

    ReplyDelete
    Replies
    1. Thanks, Now JDK working fine

      Delete
    2. Hey Jay, thanks a lot for this post, helped me also!!!

      Delete
    3. thank you very much it worked for me too.I was struggling with it since two hours and then finally your post helped.thanks a ton.:)

      Delete
    4. Awesome! Thanks!

      Delete
  2. Thanks a lot :)

    ReplyDelete
    Replies
    1. Indeed very helpful. I am agree that setting JAVA_HOME properly is not easy for new developers.

      Delete
  3. OH MY GOD, FINALLY
    BWAHAHAHAA!!
    Seriously dude, thanks.
    Found my evil files in C:\Windows\Prefetch...or something like that.

    ReplyDelete
  4. Thanks a lot!!!Such errors really make your head spin...hard to find out where the errors lie.

    ReplyDelete
  5. thanks alot it was worked fine

    ReplyDelete
  6. I did it but now it doesn't appears java as an installed program... The cmd doesn't recognize "java" as a command...

    ReplyDelete
    Replies
    1. You need to have your jdk's bin directory in path

      Delete
    2. Hi Jay
      I am also struggling with the same problem after removing the java,javaw,javaws from the c:\windows\system32,i installed the jdk in c:\JAVA and given the env variable as c:\JAVA and even tried with C:\JAVA\bin but it didn't work for me..can u help me in this

      Delete
    3. Can you check your env PATH variable and see if there is any entry which might have java? Best thing to do is to define JAVA_HOME env to point to c:\java and then make %JAVA_HOME%\bin very first entry to your PATH env variable

      Delete
  7. Thanks and Cheers from Germany!! Helped me as well!

    ReplyDelete
    Replies
    1. Glad it helped. Thanks from Amsterdam / India :-)

      Delete
  8. This helped me to solve my issue. Thanks for your post.

    ReplyDelete
  9. WOW!!! It took me A WEEK to figure this out through all the nonsense posted online about this issue. Thank you!!!

    ReplyDelete
  10. WOW!!! It took me a week to fix this issue by searching through all the nonsense posted online about it. Thanks Jay!!!

    ReplyDelete
  11. Thanks you so much this helped on windows 7

    ReplyDelete
  12. Thanks a lot! Problem solved! :D

    ReplyDelete
  13. I was struggling with this for the last 2 hrs. and this helped me...
    Thank you so much.

    ReplyDelete
  14. Thank you so much! It worked like a charm!

    ReplyDelete
  15. thank you a got the same problem with my windows8 system computer, and i've just done as you said, and it solved my problem. thanks a lot.

    ReplyDelete
  16. Thank you thank you thank you! Like many others on here, I was working on this error for at least a few hours before I found this.

    ReplyDelete
  17. Thanks a lot dude :) I am relieved.

    ReplyDelete
  18. ¡Muchas muchas gracias!

    ReplyDelete
  19. Eternal Thanks!

    ReplyDelete
  20. dude you made my day a day full of happyness

    ReplyDelete
  21. Thanks a lot.. That really helped...

    ReplyDelete
  22. SUUUUPER ça marche !!! thanks dude !

    ReplyDelete
  23. I tried, but it did not resolve.

    I don't have much space in C:\ so I installed it in E Drive. Unable to open Eclipse too..:(

    ReplyDelete
    Replies
    1. Did you set JAVA_HOME correctly to point to e:? Also set vm option in your eclipse.ini.

      Delete
  24. thanks jay :)

    why these java.exe, javaw.exe, javaws.exe, unabling to compile java program ?? and what is this jvm.cfg ?

    ReplyDelete
    Replies
    1. I think its not that its not able to compile, but to do so it needs to first lookup jvm.cfg where there are some jvm related parameters and since it can not open, it fails.

      Delete
  25. This comment has been removed by the author.

    ReplyDelete
  26. Hi,
    Thanks for the solution ! I removed java.exe, javaw.exe and javaws.exe from c:\windows\system32 and c:\windows\sysWOW64 directory .

    ReplyDelete
  27. Thanks Bro ...
    It worked awesome..
    But i had to delete them from both system32 nd 64 also..

    ReplyDelete
  28. Thank you lots man :D by italian guy

    ReplyDelete
  29. Great! It also solved my issue.

    ReplyDelete
  30. Thanks a lot!
    It helped me...
    While I was doing the wls12.1.2 setup.. I got this issue.

    ReplyDelete
  31. It really worked!!! Thanks a ton Jay!!

    ReplyDelete
  32. This is insane behavior but thanks for helping buddy!

    ReplyDelete
  33. This worked thanks a lot..............

    ReplyDelete
  34. Thank you so much !!! It worked for me perfectly !! :)

    ReplyDelete
  35. God bless you :)

    ReplyDelete
  36. God bless you :) Thanks for your contribution, so useful

    ReplyDelete
  37. Nice job dude, finally got it working :)

    ReplyDelete
  38. It worked for me as well :)
    Thanks a lot dude !!!

    ReplyDelete
  39. Totally Wrong!!! when you install another software that uses java, it shows error. the permanent solution is to add the jre bin path to the environmental variable.

    ReplyDelete
  40. Thank you very much. This worked for me and I'm quite grateful.

    ReplyDelete
  41. Thanks, Jay! It helped me too.

    ReplyDelete
  42. Thanks for the solutions! It helped me at the right time..:)

    ReplyDelete
  43. You saved my time a lot, thank you very much.

    ReplyDelete
  44. thanxx man .....!!!

    ReplyDelete
  45. Thank you! Your post saved me several more hours... Cheers!

    ReplyDelete
  46. Oh my god!!!!!!!!!!!!
    Thank you so much!!!!!!!!!!!!!!!

    ReplyDelete
  47. This has really put me off the edge . thanks very much .

    ReplyDelete
  48. Thank you very much man,, i have been wondering for a long
    time for the solution with no luck. And non of the solutions seemed to make
    sense or even work. :)

    ReplyDelete
  49. Helped me as well - thank you a lot for posting this solution!

    ReplyDelete
  50. Very helpful! Thanks a lot!

    ReplyDelete
  51. Excelente Buen Consejo Muchas Gracias

    ReplyDelete
  52. Excelente Consejo Muchas Gracias

    ReplyDelete
  53. Thanks worked for me aswell.

    ReplyDelete
  54. Thanks! This helped solved the error for me too.

    ReplyDelete
  55. Thx Buddy !!!!

    ReplyDelete
  56. Thanks alot .
    It helped me fix

    ReplyDelete
  57. Thnks a lot jay!!! It screwed me up !! Can u tell me why this error occurs..and by removing those files why everything worked?

    ReplyDelete
    Replies
    1. Its because the default installation happens in c:\program files directory. Problem here is when JAVA_HOME refers to this directory with space, some programs cannot resolve the path completely because of the space. So its strongly recommended that you install java in a directory without space or at least make sure JAVA_HOME has path without space like C:\Progra~1\

      Delete
  58. Thanks a lot, this really helped me.

    ReplyDelete
  59. THANKS A LOT BROTHER! It really helped :) Cheers!

    ReplyDelete
  60. Thanks a lot buddy. That helped me a lot.

    ReplyDelete
  61. Thank you,
    Encounter this problem when I tried to use lighttable www.lighttable.com on my windows 7 64bit.
    I had to delete java.exe, javaw.exe, and javaws.exe from C:\Windows\System32 and C:\Windows\SystemWOW64

    ReplyDelete
  62. Thanks a lot. I followed the procedure and fixed it as follows:
    1) Removed those files as explained in the post.
    2) Create C:\java containing jre and jdk.
    3) Delete all other java files.
    4) Add the address of the \bin folders of the jre and the jdk to the path and remove other paths to java.
    5) Check using cmd.

    ReplyDelete
  63. I was able to solve the same problem by placing %JAVA_HOME%\jre\bin;%JAVA_HOME%\bin; before the system folders in the PATH environment variable.

    ReplyDelete
  64. Thanks a Lot!!!! It worked---Awesome dude Awesome!

    ReplyDelete
  65. Thanks a lot!! Save my day!!

    ReplyDelete
  66. Thanks a lot!! Save my day!!

    ReplyDelete
  67. Thank you very much for sharing this info. Was always frustrating with that...


    This trick is a much needed one!!!!

    ReplyDelete
  68. Yay! Thank you!

    ReplyDelete
  69. Did not help me.. I deleted the files from system32 and still get the same error. Even set environment variables.

    ReplyDelete

Post a Comment

Popular posts from this blog

Tomcat: One or more listeners failed to start. Full details will be found in the appropriate container log file

A quick post on annoying tomcat startup error

SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file

Why annoying? As in the logs, this is all you get and if you have more than one or many listeners registered, you just keep guessing which one failed and why? I've faced this couple of times and every time I forget the "cure". So here is a small note-to-self on how to find the cause - how to make tomcat spit out details.

Whenever you face this error, under your WEB-INF/classes directory, create file logging.properties with the following content and restart the tomcat server.

org.apache.catalina.core.ContainerBase.[Catalina].level=INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers=java.util.logging.ConsoleHandler

After the restart, you should see the full stack trace of the error which is causing the startup failure.

Cheers!
- Jay

Oracle 12c: Creating users without container database

So oracle released a database which is specifically designed and developed for cloud - Oracle 12c. Since it is designed for the cloud, it's natural that there will be multiple databases for multiple applications in the cloud and its logical only to have an infrastructure that can manage all these database instances. To address this Oracle 12c comes with features like container database and pluggable database. Without going into much of the details of CDB and PDB (which honestly I don't know either) what changed is how you create the users and also name your users. Like CDB users must start with C## or c## and PDB users must not start with C## or c##. What this means is all your scripts for 10g, 11g will fail if you plan to use Oracle 12c without container DB or say much like the way you are using 10g or 11g. Failure looks something like this.

SQL Error: ORA-65096: invalid common user or role name 65096. 00000 -  "invalid common user or role name" *Cause: An attempt w…

VMWare Tools installation error 'struct file' has no member named 'f_dentry'

This is one of the annoying issues with VMWare tools installation I face at least twice while having Ubuntu as my guest OS on VMWare. As soon as I install the VMware tools on fresh VM, I get the following error

/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsPackDirOpenRequest’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:417:26: error: ‘struct file’ has no member named ‘f_dentry’
file->f_dentry) < 0) {
^
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsDirLlseek’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:707:32: error: ‘struct file’ has no member named ‘f_dentry’
struct dentry *dentry = file->f_dentry;
^
In file included from /tmp/modconfig-O5xscq/vmhgfs-only/dir.c:39:0:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c: In function ‘HgfsReaddirNextEntry’:
/tmp/modconfig-O5xscq/vmhgfs-only/dir.c:993:31: error: ‘struct file’ has no member named ‘f_dentry’
si = HGFS_SB_TO_COMMON(file->f_dentry->d_inode->i_sb);
^

After searching on google for some time, it seems that the VMware…