“system32 \ java.exe”和“Program Files \ Java \ jdk1.6.0_33 \ bin \ java.exe”有什么区别?

时间:2022-04-15 23:06:35

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.

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

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

当我在(java.exe)中为%i运行此命令时,请执行@echo。 %〜$ PATH:我,我得到这个输出: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

当我检查我的电脑时,我发现有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?

我可以知道system32 \ java.exe和Program Files \ Java \ jdk1.6.0_33 \ bin \ java.exe之间的区别是什么?为什么在(java.exe)中运行%i时只显示system32 \ java.exe @echo。 %〜$ PATH:我?

Do I still need to add C:\Program Files\Java\jdk1.6.0_33\bin\ to my PATH environment variable?

我是否仍需要将C:\ Program Files \ Java \ jdk1.6.0_33 \ bin \添加到我的PATH环境变量中?

2 个解决方案

#1


26  

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

设置PATH变量只是为了让您可以访问javac以及jdk bin文件夹中的其他程序和工具。

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

提供了\ windows \ system32 \中的java.exe,以便不是每个人都需要设置PATH变量只是为了运行java程序(从命令行)并选择已安装java的版本(最后安装它似乎)虚拟机(JVM)如果安装了多个(公共)。

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.

为了使事情进一步复杂化,system32中的java.exe只是一个虚拟。它在注册表中查找,然后决定使用哪个真正的java.exe。安装的最后一个JVM将成为使用的JVM,即使它更旧。要切换JVM,通常必须重新安装所需的JVM。

#2


11  

(Not an answer but rather a comment on Mattias's answer) Not sure about this "dummy" business. The java.exe in system32 is a normal file, not even a symbolic or hard link. Mattias may be referring to the problem that is explained here: http://msdn.microsoft.com/en-us/library/aa384187

(不是答案,而是对Mattias答案的评论)不确定这个“虚拟”业务。 system32中的java.exe是普通文件,甚至不是符号链接或硬链接。 Mattias可能指的是这里解释的问题:http://msdn.microsoft.com/en-us/library/aa384187

In a nutshell, if you have a 64-bit system and a Java installation, 32-bit applications won't see the java.exe (nor javaw.exe, javaws.exe) that is installed in C:\Windows\System32\ because they'll be presented with C:\Windows\SysWoW64\ masquerading as C:\Windows\System32. The installer fails to put a copy of java.exe in SysWoW64, hence a 32-bit app that tries to launch Java will fail to do so. This will puzzle the user if he looks in the system32 directory using explorer, since explorer is a 64-bit app and will thus see the "real" system32 directory.

简而言之,如果您有64位系统和Java安装,32位应用程序将无法看到安装在C:\ Windows \ System32 \中的java.exe(也不是javaw.exe,javaws.exe)因为它们将被呈现为C:\ Windows \ SysWoW64 \伪装成C:\ Windows \ System32。安装程序无法在SysWoW64中放置java.exe的副本,因此尝试启动Java的32位应用程序将无法执行此操作。如果用户使用资源管理器查看system32目录,这将困扰用户,因为资源管理器是一个64位应用程序,因此将看到“真正的”system32目录。

#1


26  

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

设置PATH变量只是为了让您可以访问javac以及jdk bin文件夹中的其他程序和工具。

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

提供了\ windows \ system32 \中的java.exe,以便不是每个人都需要设置PATH变量只是为了运行java程序(从命令行)并选择已安装java的版本(最后安装它似乎)虚拟机(JVM)如果安装了多个(公共)。

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.

为了使事情进一步复杂化,system32中的java.exe只是一个虚拟。它在注册表中查找,然后决定使用哪个真正的java.exe。安装的最后一个JVM将成为使用的JVM,即使它更旧。要切换JVM,通常必须重新安装所需的JVM。

#2


11  

(Not an answer but rather a comment on Mattias's answer) Not sure about this "dummy" business. The java.exe in system32 is a normal file, not even a symbolic or hard link. Mattias may be referring to the problem that is explained here: http://msdn.microsoft.com/en-us/library/aa384187

(不是答案,而是对Mattias答案的评论)不确定这个“虚拟”业务。 system32中的java.exe是普通文件,甚至不是符号链接或硬链接。 Mattias可能指的是这里解释的问题:http://msdn.microsoft.com/en-us/library/aa384187

In a nutshell, if you have a 64-bit system and a Java installation, 32-bit applications won't see the java.exe (nor javaw.exe, javaws.exe) that is installed in C:\Windows\System32\ because they'll be presented with C:\Windows\SysWoW64\ masquerading as C:\Windows\System32. The installer fails to put a copy of java.exe in SysWoW64, hence a 32-bit app that tries to launch Java will fail to do so. This will puzzle the user if he looks in the system32 directory using explorer, since explorer is a 64-bit app and will thus see the "real" system32 directory.

简而言之,如果您有64位系统和Java安装,32位应用程序将无法看到安装在C:\ Windows \ System32 \中的java.exe(也不是javaw.exe,javaws.exe)因为它们将被呈现为C:\ Windows \ SysWoW64 \伪装成C:\ Windows \ System32。安装程序无法在SysWoW64中放置java.exe的副本,因此尝试启动Java的32位应用程序将无法执行此操作。如果用户使用资源管理器查看system32目录,这将困扰用户,因为资源管理器是一个64位应用程序,因此将看到“真正的”system32目录。