java 使用 64 位和 32 位 JDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10943763/
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
using 64bit and 32 bit JDK
提问by md1hunox
I have a system running 64bit windows 7. I'm doing a project using JMF, which I found works best (or only) with 32 bit jdk. I'm using a 32bit eclipse. I also have a 64bit JDK installed. right now I have set classpath (JAVA_HOME and Path) for the 32bit JDK.
我有一个运行 64 位 Windows 7 的系统。我正在使用JMF做一个项目,我发现它在 32 位 jdk 上效果最好(或仅)。我正在使用 32 位日食。我还安装了 64 位 JDK。现在我已经为 32 位 JDK 设置了类路径(JAVA_HOME 和 Path)。
The problem is it becomes hectic to switch between the 64bit and 32 bit JDK(i have to change classpaths everytime). Is there any easier way to do that?
问题是在 64 位和 32 位 JDK 之间切换变得很忙(我每次都必须更改类路径)。有没有更简单的方法来做到这一点?
回答by SimonC
You can have multiple JREs registered with Eclipse, and associate a project or run configuration with a specific JRE. These are different from the JRE you use to run Eclipse in.
您可以将多个 JRE 注册到 Eclipse,并将项目或运行配置与特定 JRE 相关联。它们与您用来运行 Eclipse 的 JRE 不同。
回答by Stephen C
Eclipse doesn't need to depend on JAVA_HOME or PATH. You can specify the JVM to be used to run Eclipse in the eclipse.ini file, and specify the path(s) to the target JVM(s) via the Eclipse preferences.
Eclipse 不需要依赖于 JAVA_HOME 或 PATH。您可以在 eclipse.ini 文件中指定用于运行 Eclipse 的 JVM,并通过 Eclipse 首选项指定到目标 JVM 的路径。
If you have to run both 32 and 64 bit Java from the command line, you should invest some time in writing shell scripts, aliases, etc.
如果您必须从命令行运行 32 位和 64 位 Java,您应该花一些时间编写 shell 脚本、别名等。
You could write a script (to be executed using ".") that will switch the settings of PATH and JAVA_HOME.
I prefer the approach of writing simple wrapper scripts or aliases to automate the build or run steps for the software you are developing. You can embed local overrides of PATH and JAVA_HOME in these scripts.
您可以编写一个脚本(使用“.”执行)来切换 PATH 和 JAVA_HOME 的设置。
我更喜欢编写简单的包装脚本或别名的方法来自动化您正在开发的软件的构建或运行步骤。您可以在这些脚本中嵌入 PATH 和 JAVA_HOME 的本地覆盖。
回答by Sasikumar Murugesan
To run 64 bit eclipse without change environment variable
在不更改环境变量的情况下运行 64 位 Eclipse
Simply copy 64bit jre to your eclipse(64 bit) root folder and rename it as jre.
只需将 64 位 jre 复制到您的 eclipse(64 位)根文件夹并将其重命名为 jre。
回答by Vipul Shah
I would suggest just keep one JDK installed on your machine.
我建议只在您的机器上安装一个 JDK。
If you are working with JMF and Eclipse 32 bit then uninstall 64bit JDK
如果您使用的是 JMF 和 Eclipse 32 位,则卸载 64 位 JDK
As per Oracle.
按照甲骨文。