File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse JVM Selection in Mac OS X Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse JVM Selection in Mac OS X" Watch "Eclipse JVM Selection in Mac OS X" New topic

Eclipse JVM Selection in Mac OS X

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 196

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.


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 196

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.


Peter Johnson

Joined: May 14, 2008
Posts: 5812

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.

JBoss In Action
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Eclipse JVM Selection in Mac OS X
Similar Threads
Probably a silly question.... Which version of Eclipse
64-bit and 32-bit
Memory in Ubuntu installation
Since I want to use maven in my IDE should I dump eclipse for intellij
64 bit OS