2

I want to connect to another bluetooth device through my laptop's bluetooth.

I'm using bluecove library for my reference. My environment is as below Machine: Ubuntu 12.4, Quad Core, 8GB Ram. Java: 1.8 Blueove: bluecove-2.1.1-SNAPSHOT.jar, bluecove-gpl-2.1.0.jar

I have written below code to connect to the local bluetooth device.

   LocalDevice localDevice = LocalDevice.getLocalDevice();
        DiscoveryAgent agent = localDevice.getDiscoveryAgent();
        agent.startInquiry(DiscoveryAgent.GIAC, listener);

But Im getting below error when I execute this code.

Native Library bluecove not available
javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available;
resource not found libbluecove.so
load [bluecove] no bluecove in java.library.path
    at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:396)
    at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:450)
    at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:69)
    at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1044)
    at java.security.AccessController.doPrivileged(Native Method)
    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 bt.MyDiscoveryListener.main(MyDiscoveryListener.java:36)

Kindly help me out to get rid this of error. I have also tried with building native library but it didn't help.

I appreciate all your answers. Thanks.

Tejpal Borkar
  • 21
  • 1
  • 5

2 Answers2

0

Try to start your JRE like this: java.exe -Djava.library.path=your_path_to_libbluecove.so ...other options... This should at least solve the problem with 'resource not found'.

chris
  • 1,685
  • 3
  • 18
  • 28
  • Thanks Chris. Actually I have tried with command java -Djava.library.path=libbluecove.so -cp bluecove-2.1.0.jar:bluecove-gpl-2.1.0.jar:bluetooth.jar bt.MyDiscoveryListener but still it gives same error. – Tejpal Borkar Jun 24 '16 at 10:34
  • Are the .so and the JRE both 32-bit or both 64-bit? – chris Jun 27 '16 at 09:43
  • The last thing i could suggest is to type the full path to the libbluecove.so in the java.library.path. 'Resource not found' seems to be a really clear message... – chris Jun 28 '16 at 11:00
0

If you use this never released snapshot of BlueCove: BlueCove 2.1.2

It adds support for 64 bit

MrMarnic
  • 23
  • 6