蓝牙设备发现出错

我尝试使用以下代码来发现蓝牙设备

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Vector; import javax.bluetooth.DeviceClass; import javax.bluetooth.DiscoveryAgent; import javax.bluetooth.DiscoveryListener; import javax.bluetooth.LocalDevice; import javax.bluetooth.RemoteDevice; import javax.bluetooth.ServiceRecord; import javax.bluetooth.UUID; /** * * Class that discovers all bluetooth devices in the neighbourhood, * * Connects to the chosen device and checks for the presence of OBEX push service in it. * and displays their name and bluetooth address. * * */ public class BluetoothServiceDiscovery implements DiscoveryListener{ //object used for waiting private static Object lock=new Object(); //vector containing the devices discovered private static Vector vecDevices=new Vector(); private static String connectionURL=null; /** * Entry point. */ public static void main(String[] args) throws IOException { BluetoothServiceDiscovery bluetoothServiceDiscovery=new BluetoothServiceDiscovery(); //display local device address and name LocalDevice localDevice = LocalDevice.getLocalDevice(); System.out.println("Address: "+localDevice.getBluetoothAddress()); System.out.println("Name: "+localDevice.getFriendlyName()); //find devices DiscoveryAgent agent = localDevice.getDiscoveryAgent(); System.out.println("Starting device inquiry..."); agent.startInquiry(DiscoveryAgent.GIAC, bluetoothServiceDiscovery); try { synchronized(lock){ lock.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Device Inquiry Completed. "); //print all devices in vecDevices int deviceCount=vecDevices.size(); if(deviceCount <= 0){ System.out.println("No Devices Found ."); } else{ //print bluetooth device addresses and names in the format [ No. address (name) ] System.out.println("Bluetooth Devices: "); for (int i = 0; i 0){ connectionURL=servRecord[0].getConnectionURL(0,false); } synchronized(lock){ lock.notify(); } } /** * Called when the service search is over. */ public void serviceSearchCompleted(int transID, int respCode) { synchronized(lock){ lock.notify(); } } /** * Called when the device search is over. */ public void inquiryCompleted(int discType) { synchronized(lock){ lock.notify(); } }//end method }//end class 

但得到以下错误:

 Native Library intelbth_x64 not available Native Library bluecove_x64 not available Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove libraries not available at com.intel.bluetooth.BlueCoveImpl.createDetectorOnWindows(BlueCoveImpl.java:896) at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:439) at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65) at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020) at java.security.AccessController.doPrivileged(Native Method) at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018) at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011) at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75) at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95) at BluetoothServiceDiscovery.main(BluetoothServiceDiscovery.java:42) 

在eclipse中编码。 我使用的是bluecove 2.1.0和64位版本的Windows 8。

任何人都可以建议我修复?

甚至还有一个更新的版本: http : //snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/

此外,重要的是要注意这取代任何其他蓝色jar子。 因为消息表明缺少库,我最初添加了这个,并且它导致版本冲突。

实际上你添加的JAR不包含x64 dll。 从以下链接下载JAR并使用它。 它对我有用。 http://www.java2s.com/Code/Jar/b/Downloadbluecove211jar.htm