This is an automated archive made by the Lemmit Bot.

The original was posted on /r/java by /u/eliashisreddit on 2024-10-18 17:00:47+00:00.


There currently seems to be no simple way whatsoever to work with Bluetooth in Java? Say I’m using JDK21 and have a (Silicon) Mac with bluetooth enabled and a bluetooth device: how would you programmatically connect with the device and send data?

Before I started fiddling, in my head I thought “this can’t be difficult” but I’ve tried a lot from bluecove to tinyb wrappers/libraries with obscure VM flags suggested in years old discussions (-d32, not even supported in my JDK) but so far nothing worked yet. Even basic examples which just scan for devices don’t work. Most projects related to bluetooth haven’t been touched in almost a decade and don’t seem to have any recent releases. I only find archived, obsolete repositories which look great in theory but don’t work in practice. Am I overlooking some gem I haven’t tried yet?

There’s one article explaining the lack of Bluetooth support in Java and I did not manage to get any listed alternative working. Also found javabluetooth.com, maybe someone having the same frustration published it, but no luck there either. Only a nice video from 2013 showing Bluetooth support in Java ME (not SE).

I’m not saying this should be part of the JDK but I’m surprised it’s like I’m trying to light water on fire and there seems to be no “import this library and you are good to go” solution[1] whatsoever. There’s even a [Javascript API in the works] which makes it possible in the browser but apparently it’s more difficult for a “desktop” platform to work with a relatively common technology.

  • [0] errors such as ‘Native libraries for TinyB transport could not be loaded’ or ‘Native Library bluecove not available’ with seemingly no word online how to get them working? Is this a Mac/ARM/Silicon problem?
  • [1] in my quest to work programmatically with bluetooth, this nodejs library which is also unmaintained for 5+ years works out of the box, color me surprised