I have just installed Java JDK 6u33 in Windows XP. Even though I didn’t set the PATH environment variable, I am able to run java -version in command prompt.
When I run this command for %i in (java.exe) do @echo. %~$PATH:i, I get this output:
C:\WINDOWS\system32\java.exe
When I check my PC, I found that there are 2 java.exe:
1. C:\Program Files\Java\jdk1.6.0_33\bin\java.exe
2. C:\WINDOWS\system32\java.exe
May I know what is the difference between system32\java.exe and Program Files\Java\jdk1.6.0_33\bin\java.exe? Why only system32\java.exe is shown when I run for %i in (java.exe) do @echo. %~$PATH:i?
Do I still need to add C:\Program Files\Java\jdk1.6.0_33\bin\ to my PATH environment variable?
Setting the
PATHvariable is just so that you can get access tojavacand the other programs and tools in the jdk bin folder.The
java.exein\windows\system32\is provided so that not everyone needs to set a PATH variable just to run a java program (from the command line) and selects a version (the last one installed it seems) of the installed java virtual machines (JVM) if there are more than one (publicly) installed.See this link for further info:
http://mindprod.com/jgloss/javaexe.html#MULTIPLES
Quote: