将 64 位 java 更改为 32 位 java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20450859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
change 64-bit java to 32-bit java
提问by nullptr
In my system, I have 64-bit Java 1.7 installed in: C:\Program Files\Java\jdk1.7.0_40
在我的系统中,我安装了 64 位 Java 1.7:C:\Program Files\Java\jdk1.7.0_40
And
和
I have 32-bit Java 1.7 installed in : C:\Program Files (x86)\Java\jdk1.7.0_02.
我在以下位置安装了 32 位 Java 1.7:C:\Program Files (x86)\Java\jdk1.7.0_02。
When I issue java -version
command in CMD, it shows me:
当我java -version
在 CMD 中发出命令时,它显示了我:
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.
我想将 java 版本更改为 32 位。
I have tried:
我试过了:
1) Removed path to 64-bit installation from path
variable, but still CMD shows same output for java -version
command.
1) 从path
变量中删除了 64 位安装的路径,但 CMD 仍然显示相同的java -version
命令输出。
2) I have specified only 32-bit installation path in path
variable, but still CMD shows same output for java -version
command.
2)我在path
变量中只指定了 32 位安装路径,但 CMD 仍然显示相同的java -version
命令输出。
3) Then added JAVA_HOME
variable with value C:\Program Files (x86)\Java\jdk1.7.0_02
, but still CMD shows same output.
3) 然后添加JAVA_HOME
了 value 的变量C:\Program Files (x86)\Java\jdk1.7.0_02
,但 CMD 仍然显示相同的输出。
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.
4) 在 Java 控制面板->Java->Java 运行时环境设置->用户中,我已经完成了查找 32 位 java 的向导并仅启用该向导,禁用 64 位安装,但 CMD 仍显示相同的输出。
Please help me on this, I want to change Java to 32-bit without un-installing 64-bit.
请帮我解决这个问题,我想在不卸载 64 位的情况下将 Java 更改为 32 位。
More info:
更多信息:
I have restarted CMD after every changes to path or Java Control Panel.
每次更改路径或 Java 控制面板后,我都重新启动了 CMD。
I have path
and JAVA_HOME
as system variables only, no any such user variables.
我只有path
和JAVA_HOME
作为系统变量,没有任何这样的用户变量。
EDIT
编辑
I have removed all java paths setting in path variable, removed JAVA_HOME variable, and still CMD shows 64-bit.
我已经删除了路径变量中的所有 java 路径设置,删除了 JAVA_HOME 变量,但 CMD 仍然显示 64 位。
C:\Users\Meraman>echo %PATH%
C:\oraclexe\app\oracle\product.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\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL S
erver\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\DTS\Binn\;C:
\Program Files (x86)\Microsoft SQL Server\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.
将路径变量中的第一个路径设置为 32 位 java 有效。
Here is output from CMD:
这是 CMD 的输出:
C:\Users\Meraman>echo %PATH%
C:\Program Files (x86)\Java\jdk1.7.0_02\bin;C:\oraclexe\app\oracle\product.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\Tools\
Binn\;C:\Program Files (x86)\Microsoft SQL Server\Tools\binn\;C:\Program File
s (x86)\Microsoft SQL Server\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL S
erver\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>
采纳答案by JB Nizet
Make sure to have C:\Program Files (x86)\Java\jdk1.7.0_02\bin
in the PATH environment variable beforethe other paths (and in particular, before c:\windows...).
确保C:\Program Files (x86)\Java\jdk1.7.0_02\bin
PATH 环境变量位于其他路径之前(尤其是在 c:\windows... 之前)。
Also, make sure to restart your command line window after you've changed the PATH.
另外,请确保在更改 PATH 后重新启动命令行窗口。
回答by Timm
I have the same problem!
我也有同样的问题!
Please look into C:\Windows\System32...
请查看 C:\Windows\System32 ...
you will find a java.exe, javaw.exe and javaws.exe digital signed by Oracle America, Inc.
您将找到由 Oracle America, Inc. 签名的 java.exe、javaw.exe 和 javaws.exe。
Because PATH includes C:\Windows\system32 at the beginning, windows will find this java.exe before your 32 bit java.exe
因为PATH开头包含C:\Windows\system32,windows会在你的32位java.exe之前找到这个java.exe
Timm from Hamburg (Germany)
Timm 来自汉堡(德国)
回答by Jcc.Sanabria
Delete the same files (java.exe, javaw.exe and javaws.exe) at:
删除位于以下位置的相同文件(java.exe、javaw.exe 和 javaws.exe):
C:\ProgramData\Oracle\Java\javapath