Learn Java

Bluecove in RPi

Example in previous section uses bluecove-gpl-2.1.0.jar which is not portable because it uses JNI. If you use ARM or RPi and so on, just compile native codes for your target device.

Overview

Hence, if you want to use this sample, follow:

  1. Download the source code of bluecove-gpl.jar and its dependency bluecove.jar.

    Download link can be found in this google repo.

  2. Compile native code for your target device.

    You can refer to the JNI chapter.

  3. Repackage it into jar file.
  4. Replace original one.

Step by Step

  1. Download bluecove-gpl source code.
  2. Extract bluecove-gpl, for me, bluecove-2.1.0-sources.tar.gz:

    tar -zxf bluecove-gpl-2.1.0-sources.tar.gz
    
  3. make directory for its dependency bluecove.jar

    mkdir -p bluecove/target
    cd bluecove/target
    
  4. Put bluecove.jar in bluecove/target. For me,

    wget https://bluecove.googlecode.com/files/bluecove-2.1.0.jar
    
  5. Change directory to bluecove-gpl and modify `build.xml. For me,

    Change from

    <property name="product_version" value="2.1.0-SNAPSHOT"/>
    

    to

    <property name="product_version" value="2.1.0"/>
    
  6. Run ant all to get everything done.
  7. Jar file is in target directory.

More Information

Lock inside of the jar file. Its structure is like below:

├── LICENSE.txt
├── META-INF
│   └── MANIFEST.MF
├── com
│   └── intel
│       └── bluetooth
│           ├── BluetoothStackBlueZ$1.class
│           ├── BluetoothStackBlueZ$2.class
│           ├── BluetoothStackBlueZ.class
│           ├── BluetoothStackBlueZConsts.class
│           └── BluetoothStackBlueZNativeTests.class
└── libbluecove_arm.so

Notice that the share library's naming convention.

lib<XXX>_arm.so

Recall what metioned in JNI chapter.