How to prevent that java.exe is installed in Windows' system32? How to prevent that java.exe is installed in Windows' system32? windows windows

How to prevent that java.exe is installed in Windows' system32?


I discovered yesterday that there is a problem with Java versions on Windows, as you know keeping java up to date these days is critical, especially the JRE used by Internet explorer located in the Windows system32 or syswow64 folder.

You can perform a search for java in your C: drive and look at the various executable files it finds to determine if the situation applies on a specific system.

After doing some research I find that when the Java updater runs, it only updates the files installed in the JAVA home , usually located on the program files, but it does NOT update the files located in the windows system folder. As a result and since the system folder is in the default system PATH , the usage of Internet Explorer continues to use an old version of the JAVA files ( java.exe , javaw.exe , javaws.exe )

The solution is to uninstall java using the control panel uninstall programs feature, download most recent version and install again.

Cheers!Fernando


I recently upgraded to java 8 and discovered this problem as the java version under system32 was still java 7. It stops you even running version as it complains about the registry keys

U:\>java -versionError: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'has value '1.8', but '1.7' is required.Error: could not find java.dllError: Could not find Java SE Runtime Environment.

Doing the following pointed me to the culprit:

U:\>where javaC:\Windows\System32\java.exeC:\Program Files\Java\jdk1.8.0_45\bin\java.exe

I 'solved' this problem by just deleting the java under system32! I'm unsure of what consequences this will have.


You can just provide the JRE you want to use on your software and:

  • Set the JAVA_HOME variable before you run your application
  • Point to the correct java.exe file (e.g. ..\jre1.5.0_22\bin\java <your_java_main>)

This can be done in a *.bat file for example.

After running the *.bat file you created, all other java version will be ignored and it won't matter which versions are, or will be, installed on that pc.