Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

environment variables - What is the difference between "system32java.exe" and "Program FilesJavajdk1.6.0_33injava.exe"?

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:WINDOWSsystem32java.exe

When I check my PC, I found that there are 2 java.exe:
1. C:Program FilesJavajdk1.6.0_33injava.exe
2. C:WINDOWSsystem32java.exe

May I know what is the difference between system32java.exe and Program FilesJavajdk1.6.0_33injava.exe? Why only system32java.exe is shown when I run for %i in (java.exe) do @echo. %~$PATH:i?

Do I still need to add C:Program FilesJavajdk1.6.0_33in to my PATH environment variable?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Setting the PATHvariable is just so that you can get access to javac and the other programs and tools in the jdk bin folder.

The java.exe in windowssystem32 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:

To complicate things further the java.exe in system32 is just a dummy. It looks in the registry and then decides which real java.exe to use. The last JVM installed gets to be the one used, even if it is older. To switch JVM s, you must normally reinstall the one you want.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...