-->

using 64bit and 32 bit JDK

2019-07-13 15:36发布

问题:

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.

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?

回答1:

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.



回答2:

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.

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.

  • 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.



回答3:

I would suggest just keep one JDK installed on your machine.

If you are working with JMF and Eclipse 32 bit then uninstall 64bit JDK

As per Oracle.



回答4:

To run 64 bit eclipse without change environment variable

Simply copy 64bit jre to your eclipse(64 bit) root folder and rename it as jre.