“system32java.exe"和“system32java.exe"有什么区别?和“Program FilesJavajdk1.6.0_33injava.exe"?

2022-01-15 00:00:00 environment-variables java

我刚刚在 Windows XP 中安装了 Java JDK 6u33.即使我没有设置 PATH 环境变量,我也可以在命令提示符下运行 java -version.

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.

当我在 (java.exe) 中运行此命令 for %i 时,请执行 @echo.%~$PATH:i,我得到这个输出:C:WINDOWSsystem32java.exe

When I run this command for %i in (java.exe) do @echo. %~$PATH:i, I get this output: C:WINDOWSsystem32java.exe

当我检查我的电脑时,我发现有2个java.exe:
1. C:Program FilesJavajdk1.6.0_33injava.exe
2. 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

请问system32java.exeProgram FilesJavajdk1.6.0_33injava.exe有什么区别?为什么当我运行 for %i in (java.exe) do @echo 时只显示 system32java.exe.%~$PATH:i?

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?

我还需要将 C:Program FilesJavajdk1.6.0_33in 添加到我的 PATH 环境变量吗?

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

推荐答案

设置PATH变量只是为了访问javac和其他程序工具在 jdk bin 文件夹中.

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

提供了 windowssystem32 中的 java.exe,因此不是每个人都需要设置 PATH 变量来运行 java 程序(从命令行) 并且如果安装了多个(公开)安装的 Java 虚拟机 (JVM),则选择一个版本(似乎是最后安装的).

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

引用:

为了使事情进一步复杂化,system32 中的 java.exe 只是一个假程序.它查看注册表,然后决定使用哪个真正的 java.exe.最后安装的 JVM 将成为使用的那个,即使它较旧.要切换JVM,通常需要重新安装你想要的.

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.

相关文章