Frage

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

I have these two versions.

 Directory of C:\Java\Bit64

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:\Java\Bit64>

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

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

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

 Directory of C:\Windows\System32

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:\Windows\System32>

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

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

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

So ...

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

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

(2) Why?!

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

EDIT 1:

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

    C:\>echo %java_home%
    C:\Java\Bit64\jdk1.6.0_45

    C:\>echo %path%
    %java_home%\bin;C:\Python27\Lib\site-packages\PyQt4;.....................

    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:\>

EDIT 2:

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

(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%\bin
being the very first thing on the %path%.

registry

War es hilfreich?

Lösung

What a_horse_with_no_name suggested fixed my problem.

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.

Andere Tipps

Looks like you might be on Windows 7 (I could be wrong). You can access the Java control panel by:

Start > Control Panel 
Click "Programs" 
Then "Java" should appear on the bottom (below Desktop Gadgets). 
Click on Java then select the "Java" tab in the "Java Control Panel". 
Click the "View..." button.
Then you can click Find or Add and then check "Enabled" for the one you want to use.

After making changes, open a new command prompt and enter java -version to verify your changes.

I think this might address what you need.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top