简体   繁体   English

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

[英]What is the difference between “system32\java.exe” and “Program Files\Java\jdk1.6.0_33\bin\java.exe”?

I have just installed Java JDK 6u33 in Windows XP. 我刚刚在Windows XP中安装了Java JDK 6u33。 Even though I didn't set the PATH environment variable, I am able to run java -version in command prompt. 即使我没有设置PATH环境变量,我也可以在命令提示符下运行java -version

When I run this command for %i in (java.exe) do @echo. %~$PATH:i 当我for %i in (java.exe) do @echo. %~$PATH:i运行此命令时for %i in (java.exe) do @echo. %~$PATH:i for %i in (java.exe) do @echo. %~$PATH:i , I get this output: C:\\WINDOWS\\system32\\java.exe for %i in (java.exe) do @echo. %~$PATH:i ,我得到这个输出: C:\\WINDOWS\\system32\\java.exe

When I check my PC, I found that there are 2 java.exe: 当我检查我的电脑时,我发现有2个java.exe:
1. C:\\Program Files\\Java\\jdk1.6.0_33\\bin\\java.exe 1. C:\\Program Files\\Java\\jdk1.6.0_33\\bin\\java.exe
2. C:\\WINDOWS\\system32\\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 ? 我可以知道system32\\java.exeProgram 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 为什么for %i in (java.exe) do @echo. %~$PATH:i运行for %i in (java.exe) do @echo. %~$PATH:i时只显示system32\\java.exe for %i in (java.exe) do @echo. %~$PATH:i for %i in (java.exe) do @echo. %~$PATH:i ? 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? 我是否仍需要将C:\\Program Files\\Java\\jdk1.6.0_33\\bin\\到我的PATH环境变量中?

Setting the PATH variable 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 http://mindprod.com/jgloss/javaexe.html#MULTIPLES

Quote: 引用:

To complicate things further the java.exe in system32 is just a dummy. 为了使事情进一步复杂化,system32中的java.exe只是一个虚拟。 It looks in the registry and then decides which real java.exe to use. 它在注册表中查找,然后决定使用哪个真正的java.exe。 The last JVM installed gets to be the one used, even if it is older. 安装的最后一个JVM将成为使用的JVM,即使它更旧。 To switch JVM s, you must normally reinstall the one you want. 要切换JVM,通常必须重新安装所需的JVM。

(Not an answer but rather a comment on Mattias's answer) Not sure about this "dummy" business. (不是答案,而是对Mattias答案的评论)不确定这个“虚拟”业务。 The java.exe in system32 is a normal file, not even a symbolic or hard link. system32中的java.exe是普通文件,甚至不是符号链接或硬链接。 Mattias may be referring to the problem that is explained here: http://msdn.microsoft.com/en-us/library/aa384187 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. 简而言之,如果您有64位系统和Java安装,32位应用程序将无法看到安装在C:\\ Windows \\ System32 \\中的java.exe(也不是javaw.exe,javaws.exe)因为它们将被呈现为C:\\ Windows \\ SysWoW64 \\伪装成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. 安装程序无法在SysWoW64中放置java.exe的副本,因此尝试启动Java的32位应用程序将无法执行此操作。 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. 如果用户使用资源管理器查看system32目录,这将困扰用户,因为资源管理器是一个64位应用程序,因此将看到“真正的”system32目录。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.exe始终指向JRE的路径但不指向JDK - java.exe always point to the path of JRE but not JDK “系统找不到文件 C:\ProgramData\Oracle\Java\javapath\java.exe” - "The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe" 另一个“ java.exe”未被识别为内部或外部命令 - another '“java.exe”' is not recognized as an internal or external command <terminated>文件名 [java 应用程序] C:\\Program Files\\Java\\jre8\\bin\\javaw.exe - <terminated> Filename [java application] C:\Program Files\Java\jre8\bin\javaw.exe “jdk1.8.0_121/bin”中的“java”文件和“jdk1.8.0_121/jre/bin”中的“java”文件有什么区别? - Whats the difference between the “java” file found in “jdk1.8.0_121/bin” and the one that's in “jdk1.8.0_121/jre/bin”? 在用户变量和系统变量中设置Java的路径有什么区别? - What is the difference between setting the path for Java in user variables and system variables? 错误系统调用生成 C:\\Windows\\system32\\cmd.exe - error syscall spawn C:\Windows\system32\cmd.exe Java --version 提供 1.8.0 即使 JAVA_HOME 指向 C:\Program Files (x86)\Java\jdk-11.0.2\ - Java --version gives 1.8.0 even though JAVA_HOME is pointing on C:\Program Files (x86)\Java\jdk-11.0.2\ 这两个在JAVA_HOME上的导出语句有什么区别? - what is the difference between these two export statements on JAVA_HOME? JAVA_HOME环境变量和“java -version”的输出有什么区别 - What is the difference between the JAVA_HOME environment variable and the output of “java -version”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM