Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

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>
like image 869
nullptr Avatar asked Dec 08 '13 07:12

nullptr


1 Answers

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.

like image 175
JB Nizet Avatar answered Oct 24 '22 20:10

JB Nizet