When working with Bluetooth and Java on Linux there are a couple of things to take note of:
Ensure that the protocol stack is installed – BlueZ is a great choice – this is installed by default on Ubuntu 12.04
Next is to ensure that you have a Java Bluetooth library which will enable you to communicate with the BlueZ protocol stack. Bluecove is cross platform and works pretty well. Something to take note of is that Bluecove and L2CAP do not work on Windows using the winsock drivers, you will need to install the WIDCOMM Bluetooth drivers. In Linux don’t worry about this, everything is setup already.
Add your Bluetooth library to the classpath. To do this place the Bluecove libraries on the desktop, then open Terminal and navigate to the desktop and issue the following command:
- Another aiding library which is needed by Bluecove running on the BlueZ stack is the bluecove-gpl-2.1.0.jar. This should also be added to the classpath by issuing the following command:
- And the final step for getting Bluecove to work in Linux is to install the Bluetooth dev library by issuing the following command:
sudo apt-get install libbluetooth-dev