BlueCove and Snow Leopard (Mac OS X 10.6.6)

BlueCove is an implementation of JSR-82 (aka JSR082 aka JSR82; can you tell I’m trying to get this post to be pretty googleable?), which is the Java API for Bluetooth. It’s pretty necessary to have something like this if you’re trying to use Java to control Bluetooth in any sort of application. In particular, I’m using it for WiiRemoteJ, a handler for Wii remotes.

Okay, so, there’s plenty of information on the webs about getting BlueCove to work under various flavors of Linux, but I googled and googled until my googler was sore trying to find a solution for Mac OS X 10.6. Finally I figured it out, with the tangential help of this somewhat unrelated thread.

The error I was getting looked something like this:
Native Library bluecove not available
java.lang.IllegalStateException: Bluetooth failed to initialize. There is probably a problem with your local Bluetooth stack or API.
at [stack data]
Caused by: javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available

My googling indicated that this error message on Macs usually happens when you’re on a 64-bit processor, because BlueCove doesn’t support the 64-bit architecture. Well, my MacBook is 32-bit, so I’m like, that can’t possibly be the problem.


It turns out that even if you don’t have a 64-bit processor, if you’re running Snow Leopard, you have both the 32- and the 64-bit JREs installed on your system. (I know, right? I mean, why wouldn’t you autodetect which architecture you have, and only install the 64-bit JRE if it would actually be useful?) So all you have to do to fix the problem is open up your Java preferences and tell it to give the 32-bit JRE priority over the 64-bit JRE.

Here’s a picture. All you have to do is drag the 32-bit above the 64-bit.
Java preferences window.

I hope that this post has the Google-juice and that it helps someone figure this stupid thing out.


9 thoughts on “BlueCove and Snow Leopard (Mac OS X 10.6.6)

  1. Hi,

    Yep, it seems Google likes this post :) So I thought I’d help other people Googling in.

    While this would work on a Mac with a 32-bit CPU, it doesn’t help someone with a 64-bit CPU trying to get Java to work in 32-bit mode. A little more Googling got me here, and I learned that I can give “-d32” as one of the VM arguments to force the VM to work in 32-bit mode. This worked perfectly for me on a Snow Leopard with a 64-bit CPU.

    So if you have a JNI library that is only available for 32 bits, and you are on a 64-bit machine, give the “-d32” argument to the VM and you’ll be good to go.

    1. This is the solution!!! Thank you Gazi.

      I even found other not-related problems with the BlueCove source code while compiling the source. And even when I fixed them, it didn’t work.

      But -d32 solved it!! The JRE priority didn’t contribute to the solution though. That wasn’t necessary.

  2. Very sufficient google power for this post!

    I tried both fixes above (Java Preferences and the -d32 force) but to no avail on my machine.

    I’m running OS X 10.5.8 with this past summer’s Java update (10) through Eclipse 3.6.2 and when I try to force my JVM 1.6.0 into 32-bit mode it just says:

    Cannot run Java in 32 bit mode. Continuing in 64 bit mode.
    Native Library bluecove not available
    javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available

    rest of error message

    I’m still very new to this so I may be oblivious to something but I was just wondering if anyone had come across a fix for just regular old Leopard?

  3. What I had to do was rebuild everything for Java 1.5 and use that. I’ve found that bluecove works fine in JVM 1.5 but there isn’t a work around for JVM 1.6, at least in Leopard.

    Thanks for the insight though!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s