Strange Location of Java.exe on Windows XP (1)

I had to install recently (today actually) two different JDKs (and their respective JREs) on a single machine running Windows XP.

(1) I already had JDK 6 (update 7) installed (this one I installed about a month ago)

(2) Today I also installed JDK 5 (update 16)

After installing the second one (JDK 5) I modified my PATH variable in Windows XP to point to JDK 5. But when I opened a command prompt and typed

java -version

I was surprised to see that Windows was still finding and picking for execution the previous version that I had installed (JDK 6), and not the one which I wanted (JDK 5). After some research on the web, I found that some process regularly copies the following 4 files

java.exe
javacpl.cpl
javaw.exe
javaws.exe

to the Windows System32 folder ( C:\Windows\System32 ). And since this folder is usually the first entry in the PATH value on Windows XP, appending the JDK 5 bin folder to the PATH did not have the expected effect. I could not find an authoritative answer on the web saying which process and at what point exactly copies these files to the System32 folder.

So I renamed these 4 files on purpose (say from .exe to .not_exe) to make then not executables. I then continued experimenting and I uninstalled JDK 6 (update 7). After that I downloaded and installed another JDK 6 (update 10). After this install I was surprised to see the 4 files being in this folder again. I went to the folder and typed the following

C:\WINDOWS\system32>java -version

and as I expected the result was

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

So I tend to think that the install process of JDK 6 copies these 4 files to that location.

Or… maybe another process copies them… but in general I think one should be careful and check the C:\Windows\System32 folder from time to time just to see what java executables exist there, and which versions of the JDK they come from.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: