I found that on Windows 7 I had to edit the JAVA_HOME
path in the registry entry in several places to completely switch to another path for another Java installation. Changing JAVA_HOME
in environment variables is not enough. You can do a quick test yourself:
- Rename your Java home directory.
- Update the value of the
%JAVA_HOME%
environment variable to reflect the new name of your JAVA_HOME
. - Run
java -version
in a new command window.
An error message will appear
Error: could not open `C:\your_java_home_path\jre7\lib\amd64\jvm.cfg'
Therefore, this is not the same behavior as on Linux, where just changing $JAVA_HOME
enough to change the pointer to the new installation directory of your java.
Windows seems to hardcode the java home path in its registry in several places.
Start
At HKEY_LOCAL_MACHINE / SOFTWARE / JavaSoft / ...
expand each directory and edit every java home path that you find hardcoded for your new JAVA_HOME
path in every registry where it occurs.
Andre source share