https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
a

Alex Styl

09/30/2023, 7:54 AM
Was anyone able to use bluetooth in their Compose desktop app (or even a CLI kotlin/java app)? I understand this is not a Compose related question and out of scope of Compose Desktop, but im running in loops trying to find how to run java bluetooth apis on modern hardware (Mac M1).
y

yschimke

09/30/2023, 8:28 AM
Not sure if it's relevant, but some of the emulated Bluetooth options on macs struggle because of new security restrictions. Could it be that? If so, I think you can self sign for Dev. But need apple to grant for distribution.
a

Alex Styl

09/30/2023, 8:35 AM
my issue is that I am not able to run any bluetooth related code on my mac. I have found bluecove which seems to be the implementation of the bluetooth interface for java, but the official releases are not supported for 64bit architecture. I tried running my app using 32bit (JVM option -d32) but I am getting this error when I use any bluetooth API:
Copy code
Native Library bluecove not available
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available;
load resource [/var/folders/gs/9q3khlb55x7bbnk95cds2_tr0000gn/T/bluecove_alexstyl_0/libbluecove.jnilib] Can't load library: /var/folders/gs/9q3khlb55x7bbnk95cds2_tr0000gn/T/bluecove_alexstyl_0/libbluecove.jnilib
load [bluecove] no bluecove in java.library.path: /Users/alexstyl/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
	at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:397)
	at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:455)
	at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:69)
	at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1044)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1042)
	at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1035)
	at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
	at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
	at org.example.Main.main(Main.java:8)
y

yschimke

09/30/2023, 8:37 AM
Yeah, looks quite different.
a

Alex Styl

09/30/2023, 8:37 AM
actually that was a lie. Just realized that -d32 is not supported by latest java versions. will try downgrading
@yschimke yeah my case doesnt seem to be something specific to latest changes to mac os. if you look around the internet for using bluetooth on java apps, it's all ancient results for some reason. I'm either not searching for the right thing, or no one is using blueetooth in java apps for a long time (which is weird)
13 Views