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).
Solution:
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.
Aren’t the java files in system32 some kind of link or wrapper? On my win2003 servers and win7 PC I have java.exe, javaw.exe and javaws.exe but they’re all about 170kB so definitely not the full java executable itself. On my PC if I run c:\windows\system32\java -version I get the same version number as the latest installed from my Program Files (x86) directory (out of all my JREs and JDKs in there) so presumably the Java installer either updates the system32 java.exe or there’s some registry entry telling it which runtime to call. So perhaps there was something wrong with the java installation on your servers.
Note: the ones I’ve looked at have been HotSpot 7 not 6 as you have so I don’t know if it has changed in 7.
Simon Haslam
February 10, 2013 at 10:26 pm
Ah… actually there’s a handy post on the topic here: http://stackoverflow.com/questions/11063831/what-is-the-difference-between-system32-java-exe-and-program-files-java-jdk1
(check the pages linked in the answers too).
It sounds like it’s further complicated by 32/64 bit on Windows too (the servers/middleware will be running the 64 bit JVM presumably).
It all seems a bit messy really…
Simon Haslam
February 10, 2013 at 10:33 pm
Undeniably consider that which you said. Your favorite
justification seemed to be on the net the simplest
factor to take into account of. I say to you, I definitely get irked whilst other folks consider worries that they plainly
do not understand about. You controlled to hit the nail upon the highest and also defined out
the entire thing with no need side effect , other people can take a signal.
Will likely be back to get more. Thank you
articleneon.info
May 24, 2013 at 3:03 pm