简体   繁体   中英

Configure Windows to use 32-bit JRE instead of 64-bit JRE

In my system, I have 64-bit Java 1.7 installed here: C:\\Program Files\\Java\\jdk1.7.0_40

And

I have 32-bit Java 1.7 installed here: C:\\Program Files (x86)\\Java\\jdk1.7.0_02

When I issue java -version command in CMD, it shows me this:

C:\Users\Meraman>java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

I want to change Java version to 32-bit.

I have tried the following:

  1. Removed path to 64-bit installation from path variable, but still CMD shows same output for java -version command.

  2. I have specified only 32-bit installation path in path variable, but still CMD shows same output for java -version command.

  3. Then added JAVA_HOME variable with value C:\\Program Files (x86)\\Java\\jdk1.7.0_02 , but still CMD shows same output.

  4. In Java Control Panel->Java->Java Runtime Environment Settings->User, I have completed wizard to find 32-bit Java and enabled that only, with disabling 64-bit installation, but still CMD shows same output.

Please help me on this, I want to change Java to 32-bit without un-installing 64-bit.

More info:

I have restarted CMD after every changes to path or Java Control Panel.

I have path and JAVA_HOME as system variables only, no any such user variables.

EDIT

I have removed all java paths setting in path variable, removed JAVA_HOME variable, and still CMD shows 64-bit.

C:\Users\Meraman>echo %PATH%
C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Python33\;C:\Program Files (
x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system
32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.
0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files
(x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL S
erver\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:
\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\
Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;

C:\Users\Meraman>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Meraman>java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

C:\Users\Meraman>echo %JAVA_HOME%
%JAVA_HOME%

C:\Users\Meraman>

EDIT - This worked:

Setting very first path in path variable to 32-bit java worked.

Here is output from CMD:

C:\Users\Meraman>echo %PATH%
C:\Program Files (x86)\Java\jdk1.7.0_02\bin;C:\oraclexe\app\oracle\product\10.2.
0\server\bin;C:\Python33\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program F
iles (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wb
em;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Techno
logies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\
Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program File
s (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL S
erver\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual
 Studio 8\Common7\IDE\PrivateAssemblies\;

C:\Users\Meraman>javac -version
javac 1.7.0_02

C:\Users\Meraman>java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)

C:\Users\Meraman>echo %JAVA_HOME%
%JAVA_HOME%

C:\Users\Meraman>where java
C:\Program Files (x86)\Java\jdk1.7.0_02\bin\java.exe
C:\Windows\System32\java.exe

C:\Users\Meraman>

Make sure to have C:\\Program Files (x86)\\Java\\jdk1.7.0_02\\bin in the PATH environment variable before the other paths (and in particular, before c:\\windows...).

Also, make sure to restart your command line window after you've changed the PATH.

I have the same problem!

Please look into C:\\Windows\\System32...

you will find a java.exe, javaw.exe and javaws.exe digital signed by Oracle America, Inc.

Because PATH includes C:\\Windows\\system32 at the beginning, windows will find this java.exe before your 32 bit java.exe

Timm from Hamburg (Germany)

删除位于以下位置的相同文件(java.exe、javaw.exe 和 javaws.exe):

 C:\ProgramData\Oracle\Java\javapath

on our estate we have the latest Java 8 x86 and x64 installed. Experienced the same problem above PATH was referencing C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath

Changing the path above to C:\\Program Files (x86)\\Java\\jre1.8.0_ xxx \\bin resolved the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM