Where is java jre path specified in Windows 7?

I have java installed including jre 6 and 7 on Windows 7 64-bit. When I type java -version at the command line I get:

C:\>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

I wanted to make jre7 the default java from the command line so I went to edit my path when I notice java isn't specified anywhere in either System Variables or User Variables (nor is there a JAVA_HOME variable either). Also running set from the command line confirms this as the Path variable has no java directory. My java is stored in the normal C:\Program Files\Java\jre6.

So now I'm curious how is windows finding my current java on the command line?


Found a stackoverflow question which has the solution: JRE installation directory in Windows

Running where java gives the output:

C:\>where java
C:\Windows\System32\java.exe

(Didn't realize windows had where command just knew it didn't have which.) Curious how java.exe ended up there.

Update

This oracle article, Deploying the JRE on Windows, states that the Java installer will copy java.exe into the system directory:

By default, the installer places a copy of the runtime environment in the C:\Program Files\Java\jre1.6.0 directory. In addition, if no more recent version is already installed on the machine, the installer puts copies of the java and javaw application-launcher executables in the Microsoft Windows system directory. (The system directory varies depending on the Microsoft Windows version, but is usually either C:\winnt\system32 or C:\windows\system.)


C:\Windows\system32\java.exe is a pretty common location.