Looking at the Java Preferences with OS X it appears that I have both 64 bit and 32bit JVM's installed. The preferences seem to indicate that you can specify the search order. When I'm in Eclipse I seems to have found a JVM by default - I assume it's the 64 default version. As my application is being targeted for a 32bit Windows platform I would like to nominate the 32bit JVM for a specific project in Eclipse without having to specify a global OS wide preference.
My whole assumption here is that the class files generated are 32/64 bit specific ?
If anyone has OS X Eclipse specific experience and can help it would be most appreciated.
Class files are NOT 32/64 bit specific. Java is "Write Once, Run Anywhere", and that means at the binary level, not just the source level.
First, however, realize that the JVM that's executing Eclipse is not necessarily the JVM that you code under development is compiled and run under. The two are totally separate environments.
Eclipse doesn't have a "default java". Whatever JVM is in the executing shell's PATH environment is going to be the one that is used. If there were multiple JVMs added to the PATH the usual search order applies (although could someone confirm/deny that JAVA_HOME overrides this? I forget and I'm too lazy to check). In any event, there are specific rules at work here, whether I remember them exactly or not.
You can install development JVMs into Eclipse using the Preference dialog, and then pick a default JVM which may be overridden (if desired) on a per-project basis.
You can mix and match 32 and 64-bit JVMs for Eclipse and JDK use in any way that benefits you, since each JVM is totally self-contained. Obviously, if you add native-code extensions to a JVM, that would be different, but few of us do that these days.
An IDE is no substitute for an Intelligent Developer.
Thanks for this. However your reply does prompt another question. Why does my OSX have both 64bit and 32bit JVM's installed if the 64 bit version can interpret/run 32bit class files ?
Also the only place which seems to show both 32 and 64 bit JVM's is in the Apple Control Panel. I was expecting to find them installed in different directories like you would get in windows - but I cannot find them.
Why does my OSX have both 64bit and 32bit JVM's installed if the 64 bit version can interpret/run 32bit class files ?
Because if a specific Java app needs to use a native library, and that native library is 32-bit, then only the 32-bit JVM will work with. Similarly if a 32-bit native program wants to load the JVM to run, then it can load only the 32-bit JVM.
Thus, having both 32-bit and 64-bit JVMs available is useful when working with non-Java code. If your app is pure Java, then it doesn't matter.
BTW, there is no such thing as a "32-bit class file". There is no "bitness" associated with class files and they can be run by JVMs running in any bitness. For example, one of our mainframes uses 48-bit words and and the 48-bit JVM on it runs class files just fine.