While trying to compile applications for the Mindstorm NXT with a modern version of Eclipse on a Mac you’ll likely run into the deadly error, “Error: This Java instance does not support a 32-bit JVM.”. The need is clear – you need 32 bit Java support – but how? I tried various JVM flags (-d32) and trying to change where Eclipse found Java but no luck! Below I’ve detailed what worked for me.
The first step is to figure out if you have the older 1.6 version of Java on your Mac. For this just look in the directory /System/Library/Java/JavaVirtualMachines/. If you’ve had your Mac for a while you likely have the directory “1.6.0.jdk” and you’re ready to move on to the next step. If you don’t you can find it here.
Changing Eclipse to use the JDK was tricky until I found the RIGHT way, then it was easy of course. Go to /Applications/Eclipse/Eclipse.app in Finder. Right click and choose “Show Package Contents”. Next open Contents/Info.plist with a text editor (not plist editor). You’ll notice at the bottom there are actually instructions on how to launch Eclipse with a different VM. I simply stole the commented out line below and pasted it under Eclipse/array.
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
All is working now! If you’re trying to get Eclipse on your Mac working with leJOS hope that helps!