javax.bluetooth.BluetoothStateException: java.lang.No ClassDefFoundError: com/sun/kve

Hello,

I am currently new to java Bluetooth and I found a code which detects devices but when I compile it in Netbeans 6.1, i get a compiler warning but when I run it I get this error

Exception in thread “main” javax.bluetooth.BluetoothStateException: java.lang.No
ClassDefFoundError: com/sun/kvem/jsr082/bluetooth/DiscoveryAgentImpl
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:100)

I have set the class path in Environmental Variables t0 have the bluecove.jar and the jsr082.jar as well as importing the bluecove.jar and the jsr082.jar in Netbeans.

When I run from Command line, I get these errors
C:\SCHOOL WORK\FINAL PROJECT\APPS\bluecove_test\src>javac -classpath “%CLASSPATH
%;” bluecove_test.java
bluecove_test.java:12: package javax.bluetooth does not exist
import javax.bluetooth.*;
^
bluecove_test.java:13: package javax.bluetooth does not exist
import javax.bluetooth.LocalDevice;
^
bluecove_test.java:29: cannot find symbol
symbol : class DiscoveryListener
location: class bluecove_test
DiscoveryListener listener = new DiscoveryListener() {
^
bluecove_test.java:29: cannot find symbol
symbol : class DiscoveryListener
location: class bluecove_test
DiscoveryListener listener = new DiscoveryListener() {
^
bluecove_test.java:55: cannot find symbol
symbol : variable DiscoveryAgent
location: class bluecove_test
boolean started = LocalDevice.getLocalDevice().getDiscoveryAgent().startInquiry(
DiscoveryAgent.GIAC, listener);

^
bluecove_test.java:55: cannot find symbol
symbol : variable LocalDevice
location: class bluecove_test
boolean started = LocalDevice.getLocalDevice().getDiscoveryAgent().startInquiry(
DiscoveryAgent.GIAC, listener);
^
6 errors

and when I run set CLASSPATH, these jar files are in the classpath.

I even tried compiling with

C:\SCHOOL WORK\FINAL PROJECT\APPS\bluecove_test\src>javac -classpath “%CLASSPATH %;” bluecove_test.java

compiling with the classpath I am still getting these errors

PLEASE HELP.

Thanks in advance

Tosin

I think you are using your classpath wrong.

Try just running:


javac -classpath "%CLASSPATH

Since you set your machines environment classpath, java will default to that classpath when run.

Best of luck.

thanks, it is now working, but when I run it, i can see my 2 mobiles phones.
I am trying to create a j2se desktop app which can communicate with a j2me midlet and pass information across each other.

Now the remote discovery can detect my two phones but It keeps saying waiting for client to connect. how do I connect my midlet to the j2se desktop app and do I need to create a bluetooth service.

Thanks in advance

THAT is a good question and I’m glad you asked.

No idea…

You are going to have to look into the blue tooth api that you’re using. HOPEFULLY, the documentation is good enough to explain all that to you…

Best of Luck.

Hi tossie79. I have probs in compiling an example that connects a bluetooth mobile device with a server in a desktop. Have put your bt program to work?
Thanks