could not open jre6\lib\i386\jvm.cfg
Recently I spend some time at a customer that runs Windows, Windows 2008 R2 to be exact. My advise: don’t, especially that UAC business costs lots of extra time. Oracle and Windows is not match in heaven, but if you happen to end up at a customer running that operating system you might run into the error I used as title for this blogpost too. The error is generic for any Windows system.
When you install a new JDK (don’t forget to run as administrator) and install this in a new JAVA_HOME, this all works perfectly. Only when you next open a dosbox by calling cmd (again, don’t forget to run as administrator again) set your JAVA_HOME and PATH and call
java -version you end up with the dreaded
could not open jre6\lib\i386\jvm.cfg error. This is kind of annoying, since no references to any JAVA_HOME is in your PATH apart from the one you just set.
It turns out that upon installation of the first JDK actually java.exe (and some more java* executables) are copied to
c:\windows\system32 and that happens to be the location of your cmd box when you open it. Since . is in the path first, you run the local java.exe when you call java instead of the java.exe from
JAVA_HOME/bin (what I expected).
navigate to some other directory before you call java (like
cd \ ) or delete the java.exe file from
c:\windows\system32 . The latter could give some unexpected results so navigating to a different directory is what I prefer.
Hope this helps.