Windows 7 - System32 文件夹 - java.exe

2022-01-18 00:00:00 path windows windows-7-x64 windows-7 java

我在 SO 上发现了一些类似的问题,但是
他们似乎都没有提供实际的答案.

I found a few similar questions here on SO but
none of them seems to provide an actual answer.

我有这两个版本.

 Directory of C:JavaBit64

01/19/2014  05:40 AM    <DIR>          .
01/19/2014  05:40 AM    <DIR>          ..
10/18/2013  07:53 AM    <DIR>          jdk1.6.0_45
01/19/2014  05:42 AM    <DIR>          jdk1.7.0_51
10/16/2013  03:15 PM    <DIR>          jre1.6.0_45
01/19/2014  05:40 AM    <DIR>          jre1.7.0_51
               0 File(s)              0 bytes
               6 Dir(s)  45,369,233,408 bytes free

C:JavaBit64>

我希望我的 Java 6 版本成为默认版本.

I want my Java 6 version to be the default one.

不幸的是,在 C:WindowsSystem32 我还有一些其他的
我不确定我何时以及如何安装的 java.exe.

Unfortunately in C:WindowsSystem32 I have some other
java.exe which I am not sure when and how was installed by me.

C:WindowsSystem32>dir jav*
 Volume in drive C is OS
 Volume Serial Number is xxxx-yyyy

 Directory of C:WindowsSystem32

01/19/2014  05:40 AM           189,352 java.exe
01/19/2014  05:40 AM           189,352 javaw.exe
01/19/2014  05:40 AM           312,744 javaws.exe
               3 File(s)        731,896 bytes
               0 Dir(s)  45,369,040,896 bytes free

C:WindowsSystem32>

不幸的是,我什至无法重命名 System32 中的 java.exe.

Unfortunately I cannot even rename the java.exe in System32.

    C:WindowsSystem32>move java.exe  java___exe
    Access is denied.
            0 file(s) moved.

我记得在 Java 中对此有一些选项
控制面板,但我不确定是哪个.

I recall there were some options for this in the Java
Control panel but I am not sure which ones exactly.

所以……

(1) 如何以正确的方式将我的 Java 6 设为默认版本?

(1) How do I make my Java 6 the default one in the right way?

我不确定我是否要在 PATH %java_home%in 之前
C:WindowsSystem32.但即使我这样做,它仍然会选择 Java 7.

I am not sure I want to put on my PATH %java_home%in before
C:WindowsSystem32. But even if I do this, it still picks up Java 7.

(2) 为什么?!

(3) 如果我重新安装这两个版本会有帮助吗?

(3) If I reinstall both versions will it help?

编辑 1:

这是最奇怪的事情(我尝试过基于
在这个问题下发表的一些评论).

This is the most weird thing (I tried that based
on a few comments posted under this question).

    C:>echo %java_home%
    C:JavaBit64jdk1.6.0_45

    C:>echo %path%
    %java_home%in;C:Python27Libsite-packagesPyQt4;.....................

    C:>java -version
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
    java version "1.7.0_51"
    Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

    C:>

编辑 2:

好的,我卸载了两个 JDK.然后我安装了 JDK 7 和
JDK 6(没有任何公共 JRE).而且我在7后安装了6.

OK, I uninstalled both JDKs. Then I installed JDK 7 and
JDK 6 (without any public JREs). And I installed 6 after 7.

(4) 有谁知道这个关键的当前版本"是什么意思
哪个程序使用它?我期待它被设置为
1.6 因为我安装了 JDK 6 秒.不过,现在我没有
看到任何问题,JDK 6 是默认的,我猜是由于 %java_home%in
成为%path% 上的第一件事.

(4) Does anyone know what this key 'current version' means
and which program uses it? I was expecting it to be set to
1.6 as I installed JDK 6 second. Still, right now I don't
see any issues, JDK 6 is default, I guess due to %java_home%in
being the very first thing on the %path%.

推荐答案

a_horse_with_no_name 的建议解决了我的问题.

What a_horse_with_no_name suggested fixed my problem.

我卸载了两个 JDK(6 和 7),然后我重新安装了两个没有
检查安装公共 JRE"选项.这真的解决了一切.现在行为是完全可以预测的(我可以通过按照我想要的方式设置我的 Windows PATH 来控制它).
另外,我的 System32 文件夹中没有任何 java.exe.

I uninstalled both JDKs (6 and 7), then I reinstalled both of them without
checking the 'install public JRE' option. This really fixed everything. Now the behavior is totally predictable (I can control it with setting my Windows PATH in the way I want).
Also, I don't have any java.exe in my System32 folder.

在此处发布此答案,以便其他人可以从中受益.

Posting this answer here just so that others could benefit from it.

相关文章