| Reply | « Previous Thread | Next Thread » |
|
Hi all,
To discover the devices using a J2SE program i am finding errors for it. My code is as Code: System.out.println("Button for Discover Devices"); try { System.out.println("Try block entered"); LocalDevice localDevice = null; localDevice = LocalDevice.getLocalDevice(); System.out.println("getLocalDevice"); discoveryAgent = localDevice.getDiscoveryAgent(); System.out.println("getDiscoveryAgent called"); updateStatus("[client:] LocalDevice properties: " + localDevice.getFriendlyName() + " (" + localDevice.getBluetoothAddress() + ")"); updateStatus("[client:]Searching for Bluetooth devices in the vicinity..."); discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this); } catch(Exception e) { e.printStackTrace(); } When i run this program, i get the following error. Button for Discover Devices Try block entered javax.bluetooth.BluetoothStateException at com.sun.kvem.jsr082.bluetooth.LocalDeviceImpl.<init>(LocalDeviceImpl.java:185) at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:94) at devang.FileClient.actionPerformed(FileClient.java:105) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6041) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5806) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4413) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4243) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Component.dispatchEvent(Component.java:4243) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Can anyone pl tell me why is the getLocalDevice() method causing problems? I have included JSR-82 from Wireless Toolkit library also. Also can anyone provide me with the code for transferring a file from PC(or laptop) to mobile through Bluetooth? |
| vijusan_2000 |
| View Public Profile |
| Find all posts by vijusan_2000 |
|
Is your Bluetooth on?
|
|
Hey maozet,
Thanks for the quick reply. Yes the bluetooth is on and still the same exception. Surprisingly, almost the same thing works on the mobile phone in a normal way. I feel it's something to do with some bluetooth configurations of a laptop, may be. Please let me know if you want any more info about code snippet or the exception. Don't get surprised, me and vijusan are doing the project together. |
|
Has the localdevice.getlocaldevice() got anything to do with the way a bluetooth has been configured? We are using a Bluetooth dongle connected through USB. I traced the program and encounters an error exactly on this statement
localDevice = LocalDevice.getLocalDevice(); We got the BluetoothStateExcption error. javax.bluetooth.BluetoothStateException: java.lang.NoClassDefFoundError: com/sun/kvem/jsr082/bluetooth/DiscoveryAgentImpl If anyone has any ideas or suggestions then pl help. We r adding JSR82.jar externally through Configuring Buildpath in Eclipse imported from Sun Wireless Toolkit Library. The same program with some minor changes made is running perfectly fine on the mobile. |
| vijusan_2000 |
| View Public Profile |
| Find all posts by vijusan_2000 |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| sdk series60 bluetooth discovery example.... | fuchsia1155 | Bluetooth Technology | 1 | 2007-05-11 09:36 |
| Bluetooth Discovery example | fuchsia1155 | Bluetooth Technology | 3 | 2007-05-10 11:39 |
| How To Incorporate A Wait Note With A BlueTooth Service Discovery? | Mo7ammed_01 | Bluetooth Technology | 2 | 2006-07-14 09:22 |
| java bluetooth service discovery with 6600 | jdevmo | Bluetooth Technology | 7 | 2006-05-26 17:08 |
| Nokia 7650 support Bluetooth audo? | ovjo12 | Bluetooth Technology | 5 | 2003-07-17 19:50 |