Bluetooth 搜索蓝牙设备

Bluetooth 搜索蓝牙设备,bluetooth,Bluetooth,我正试图编写一个java程序来搜索附近的蓝牙设备。。 Im使用Bluecove-glp-2.1.0和Bluecove 2.1.0 我在Ubuntu 13.04 LTS上工作 我键入一个代码以获取本地设备名 package bluetoothsearch; import javax.bluetooth.*; public class BluetoothSearch { public static void main(String[] args) { LocalDev

我正试图编写一个java程序来搜索附近的蓝牙设备。。 Im使用Bluecove-glp-2.1.0和Bluecove 2.1.0

我在Ubuntu 13.04 LTS上工作

我键入一个代码以获取本地设备名

package bluetoothsearch;
import javax.bluetooth.*;
public class BluetoothSearch {

    public static void main(String[] args) {
           LocalDevice ld= null ;
           String name = ld.getBluetoothAddress();
           System.out.print(name);

    }   
}
这是我的密码

它返回空值。不会将本地设备返回给我


如果有人帮忙,它会非常棒。

您设置ld=null,然后调用它的方法。它看起来不一致,但显示错误。它说id必须初始化。!!