🤔 Are you backing up your git repositories?

Nick Jones

Product-Focused CTO, Founder,
Software Engineer, Indie Hacker

Working with LeJOS on Mac OSX

I’ve been having a bit of trouble getting LeJOS working correctly on my machine, with error messages like:

1
2
3
4
5
[java] leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
[java] Native Library bluecove not available
[java] leJOS NXJ> Exception in open: Open of NXT failed: BlueCove library bluecove not available
[java] leJOS NXJ> Failed to connect to any NXT
[java] An error occurred: No NXT found - is it switched on and plugged in (for USB)?

A similar error message also appear when trying to use nxjbrowse with USB or Bluetooth:

leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver

Assuming you’ve done everything correctly with the online tutorial, then in order to get things running on USB and Bluetooth you’ll need to ensure that you’re using the 32-bit version of the JVM, not the default 64-bit.

Some blogs were insisting that all you need to do is open Java Preferences and switch the 32 and 64-bit around in order, but that didn’t work for me.

Instead, I had to manually specify the -d32 switch on all calls to java, including in your ant build script.

Adding the switch to the tools in the bin/ directory of the lejos unzip is trivial (the call to Java is on the last line of every file). Adding to the ant build script (for the sample projects) is done by adding:

<jvmarg value="-d32"/>

..where ever you see similar jvmarg tags, specifically in the samplebuild.xml file.