bluetooth problem

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

bluetooth problem

Postby cheung_carmen » Fri Nov 09, 2007 12:34 am

I try to run the BTSend sample on my pc but it comes out the following error.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/bluetooth/DiscoveryListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at lejos.pc.comm.NXTCommFactory.createNXTComm(NXTCommFactory.java:17)
at BTSend.main(BTSend.java:7)

I did add the library in ecilpse. and the bluetooth is work fine on nxj -b. any one can tell me how can i get it sort.

Thx
cheung_carmen
New User
 
Posts: 2
Joined: Fri Nov 09, 2007 12:22 am

Postby lawrie » Mon Nov 12, 2007 11:39 pm

You need to add bluecove.jar to the CLASSPATH.
lawrie
leJOS Team Member
 
Posts: 909
Joined: Mon Feb 05, 2007 1:27 pm

Postby monkey525467 » Tue Nov 13, 2007 1:31 pm

I have tried the following and this is what I get
C:\java\icommand\samples>nxjc NXJTest.java
NXJTest.java:1: package icommand.nxt.comm does not exist
import icommand.nxt.comm.NXTCommand;
^
NXJTest.java:2: package icommand.nxt does not exist
import icommand.nxt.*;
^
NXJTest.java:6: cannot find symbol
symbol : variable NXTCommand
location: class NXJTest
NXTCommand.open();
^
NXJTest.java:7: cannot find symbol
symbol : variable NXTCommand
location: class NXJTest
NXTCommand.setVerify(true);
^
NXJTest.java:8: package Motor does not exist
Motor.B.setSpeed(700);
^
NXJTest.java:9: cannot find symbol
symbol : variable Battery
location: class NXJTest
System.out.println("Battery = " + Battery.getVoltageMilliVolt());
^
NXJTest.java:9: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Battery = " + Battery.getVoltageMilliVolt());
^
NXJTest.java:10: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Waiting for motor to stop");
^
NXJTest.java:11: package Motor does not exist
Motor.B.rotateTo(400);
^
NXJTest.java:12: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Motor has stopped.");
^
NXJTest.java:13: package Motor does not exist
System.out.println("Motor tacho = " + Motor.B.getTachoCount());
^
NXJTest.java:13: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Motor tacho = " + Motor.B.getTachoCount());
^
NXJTest.java:14: cannot find symbol
symbol : class LightSensor
location: class NXJTest
LightSensor ls = new LightSensor(SensorPort.S1);
^
NXJTest.java:14: cannot find symbol
symbol : class LightSensor
location: class NXJTest
LightSensor ls = new LightSensor(SensorPort.S1);
^
NXJTest.java:14: cannot find symbol
symbol : variable SensorPort
location: class NXJTest
LightSensor ls = new LightSensor(SensorPort.S1);
^
NXJTest.java:15: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Light sensor Port 1: " + ls.getLightValue());
^
NXJTest.java:16: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("% Light Port 1: " + ls.getLightPercent());
^
NXJTest.java:17: cannot find symbol
symbol : variable out
location: class java.lang.System
System.out.println("Closing shop");
^
NXJTest.java:18: cannot find symbol
symbol : variable NXTCommand
location: class NXJTest
NXTCommand.close();
^
19 errors

I am running Win XP Sp2
We must not let technology overtake us; we must harness the power of it --Carson Shook
User avatar
monkey525467
New User
 
Posts: 21
Joined: Sun Jul 08, 2007 2:18 am

Postby lawrie » Sat Nov 17, 2007 3:31 pm

You cannot compile iCommand programs with nxjc - it is for leJOS NXJ programs that run on the brick only. Look at the iCommand docuumentation for how to compile iCommand programs. You will need the iCommand jar file o the CLASSPATH.
lawrie
leJOS Team Member
 
Posts: 909
Joined: Mon Feb 05, 2007 1:27 pm

Postby monkey525467 » Sun Nov 18, 2007 3:15 pm

By documentation, do you mean the readme or is this something else? also, I have the iCommand jar file in the CLASSPATH.

Thanks!
We must not let technology overtake us; we must harness the power of it --Carson Shook
User avatar
monkey525467
New User
 
Posts: 21
Joined: Sun Jul 08, 2007 2:18 am

Postby bbagnall » Thu Nov 29, 2007 6:26 pm

Hi Monkey,

You need to figure out what you want to do first. Do you want to:
1) Compile and run Java code right on the NXT brick
2) Run Java code on your PC that controls the NXT brick via a Bluetooth dongle?

If you want 1) then you download ONLY leJOS NXJ and follow those instructions only.

If you want 2) then download iCommand and follow those instructions only.

My guess is that, unless you are doing something specialized (like a wireless webcam for a project), you should probably use 1).
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby monkey525467 » Fri Nov 30, 2007 2:53 am

Actually I am trying 2 because I am working through Maximum NXT: Building robots with Java Brains and I'm trying the first icommand project (and I don't have Eclipse installed on my computer because I only have dial-up)
We must not let technology overtake us; we must harness the power of it --Carson Shook
User avatar
monkey525467
New User
 
Posts: 21
Joined: Sun Jul 08, 2007 2:18 am

Postby lawrie » Sun Dec 02, 2007 9:16 am

Are you still having problems running iCommand? You need icommand.jar and bluecove.jar on the CLASSPATH. You then compile the iCommand program with javac (not nxjc) and run it with the java command.
lawrie
leJOS Team Member
 
Posts: 909
Joined: Mon Feb 05, 2007 1:27 pm

Postby monkey525467 » Sun Dec 02, 2007 9:57 pm

:D :D :D IT WORKS!!!! :D :D :D

Thank you all so much for your time and effort, I realized that I needed an extra "\icommand\" in both jar file locations, and I was using nxjc instead of javac, THANKS :wink:
User avatar
monkey525467
New User
 
Posts: 21
Joined: Sun Jul 08, 2007 2:18 am


Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests

more stuff