3

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?

md1hunox
  • 3,815
  • 10
  • 45
  • 67
  • 1
    Just keep 32bit JDK on your machine.AFAIK 32bit eclipse has problem with 64 bit JDK – Vipul Jun 08 '12 at 06:03
  • @vineetrok what do you mean when you say have '64bit jdk active'? – SimonC Jun 08 '12 at 06:24
  • I dont know whether its the right term to say. but by that i meant that i have classpaths set for the 64Bit JDK. and executing "java -version" in command prompt shows the 64Bit JDK. – md1hunox Jun 08 '12 at 06:51

4 Answers4

5

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.

SimonC
  • 6,590
  • 1
  • 23
  • 40
  • I tried running multiple JRE's. but JMF started giving problems(dont know why). This time I didnt install the JRE while installing 64bit JDK. should I do that? – md1hunox Jun 08 '12 at 06:09
  • JMF wasn't initializing, and moreover, it doesnt work with 64 bit JDK/JRE. I just wanted to know, whether there is an easier/better way to switch between 64/32 bit JDK/JRE. – md1hunox Jun 08 '12 at 06:15
  • 2
    I run a 32 bit Eclipse (4.2) which picks up the native 32 bit javaw (for me c:\windows\system32\javaw.exe). I then tell Eclipse to use the 64 JDK I installed (currently C:\Program Files\Java\jdk1.6.0_23) to build and run my projects with. You should be able to add a 32 bit JDK there as well and point your JMF dependent projects at that. – SimonC Jun 08 '12 at 06:21
  • @ SimonC That worked!! I'm now using only 64 bit eclipse. Classpaths set for 64 bit JDK. I now have both the JDK's in the Preferences>Java>installed JRE's. and my JMF project works fine and so do my projects which use 64bit JDK. Thanks Alot :) – md1hunox Jun 08 '12 at 06:49
3

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

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.

enter image description here

Vipul
  • 27,808
  • 7
  • 60
  • 75
0

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.

Sasikumar Murugesan
  • 4,412
  • 10
  • 51
  • 74