Bluecove programming problem

7 posts
by MyRevel » Sun Oct 20, 2013 8:00 pm

I'm not able to get my java Bluetooth application up and running on my Raspberry Pi.
It runs well on my Windows PC
Bluetooth itself works fine on my Rasp when I check it with "hcitool scan"

I use the Bluecove library and when I start the jar on my Rasp I directly get an error stating: "Native Library bluecove_arm not available"

I scanned the internet and tried all tips and tricks I found.
The most helpful sites were:

But none of them could solve my problem.

Can somebody who has a java Bluetooth application successful running on his Rasp tell me how he managed that?

On my Raspberry Pi I installed the latest image (2013-09-10-wheezy-raspbian.img) together with Java(TM) SE Runtime Environment (build 1.7.0_40-b43)

Many thanks,
Posts: 4
Joined: Mon Mar 04, 2013 6:04 pm
by MyRevel » Wed Oct 23, 2013 7:51 pm

Here a step by step description how I succeed to get the needed Raspberry bluecove-gpl-2.1.0.jar:

On my Windows PC:

Download bluecove-2.1.0.jar and bluecove-gpl-2.1.0-sources.tar.gz from:

Prepare source:
    1) Unzip bluecove-gpl-2.1.0-sources.tar.gz
    2) go into folder bluecove-gpl-2.1.0 and open file build.xml in a text editor
    3) Delete text '-SNAPSHOT' in line 12:
    change: <property name="product_version" value="2.1.0-SNAPSHOT"/>
    into: <property name="product_version" value="2.1.0"/>
    4) save file

Open Raspberry Pi in program WinSCP and go into home folder (/home/pi)
Create new folder named temp
Go into temp folder (/home/pi/temp)
Copy complete folder bluecove-gpl-2.1.0 including modified build.xml file into folder temp
Add new folders bluecove/target into temp (/home/pi/temp/bluecove/target/)
Copy bluecove-2.1.0.jar into folder /home/pi/temp/bluecove/target/
(now folder temp includes two folders: bluecove-gpl-2.1.0 and bluecove)

Open Raspberry Pi in program Putty

Install Bluetooth:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get autoremove
    sudo apt-get install bluetooth bluez-utils blueman

Connect Blutooth dongle and test if Bluetooth OK:
    /etc/init.d/bluetooth status -> check to see whether the bluetooth is live
    hcitool scan -> show any devices in range of the dongle

Install the BlueZ devel package needed for compilation later:
    sudo apt-get install libbluetooth-dev

Install Apache Ant:
    sudo apt-get install ant

After all these updates I prefer to reboot:
    sudo reboot

Go into folder bluecove-gpl-2.1.0:
    cd /home/pi/temp/bluecove-gpl-2.1.0

Start compilation:
    ant all

When successful compiled you can find the required gpl jar in:
Add the file bluecove-gpl-2.1.0.jar together with bluecove-2.1.0.jar into
your java build path libraries of your java development program.
Posts: 4
Joined: Mon Mar 04, 2013 6:04 pm
by eben » Mon Oct 28, 2013 11:01 pm
Blimey. Bluecove. That takes me back. From AUTHORS.txt:

"BlueCove was written and maintained by: 2004 James Scott, Eben Upton and Christophe Diot at Intel Research Cambridge"
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 85
Joined: Sun Jul 17, 2011 11:54 am
by sergiolj09 » Thu Apr 24, 2014 6:36 pm
Hello everyone:

First of all thank MyRevel for creating this useful guide. I would like to say that I have had trouble getting to recognize my bluetooth dongle and Raspberry Pi. I've solved by running the command:

Code: Select all

after the command
Code: Select all
sudo apt-get install blueman bluetooth bluez-utils

Moreover, all great

thanks :D
Posts: 2
Joined: Mon Mar 31, 2014 5:01 pm
by abbas-h » Wed Apr 30, 2014 1:33 pm
hi all
i done all steps ...
but whene i run java app writed in windows i get this error from terminal

Code: Select all
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove not available
        at Method)
        at javax.bluetooth.LocalDevice.getLocalDeviceInstance(
        at javax.bluetooth.LocalDevice.getLocalDevice(
        at bluetest.Bluetest.main(

please help me
Posts: 37
Joined: Wed Apr 30, 2014 1:30 pm
by MyRevel » Fri May 02, 2014 9:36 am
Hi abbas-h

What I understand from your question is that you are running your java program on a Windows PC and you get that error message.
I can reproduce simulair error when I run a program and the bluetooth dongle is not well installed on my Windows XP PC.

So my question: is your dongle correctly installed and can you setup connections from other devices like mobile phone to your PC?
If not, please check your bluetooth dongle installation.

Posts: 4
Joined: Mon Mar 04, 2013 6:04 pm
by vnrgoli » Sat Apr 01, 2017 9:56 pm
This process above did not work.
I got below errors from Maven:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project obd-java-api: Compilation failure: Compilation failure:
[ERROR] /home/pi/vg/raceiq-obdii-api/src/main/java/com/TestHarness/[17,1] package javax.bluetooth does not exist
[ERROR] /home/pi/vg/raceiq-obdii-api/src/main/java/com/TestHarness/[18,1] package javax.bluetooth does not exist

Any clues? it has been a nightmare to develop Bluetooth project on raspi.
Posts: 8
Joined: Sat Apr 01, 2017 7:57 pm