Problems with leJOS on the Raspberry Pi

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

Moderators: 99jonathan, roger, imaqine

Problems with leJOS on the Raspberry Pi

Postby Baschdl » Sun Dec 22, 2013 12:10 am

Hello together,

We would like to use lejos on a Raspberry Pi for our RoboCup project but we got
stuck at the communication between the brick and the Pi. Running the USBSend
on our computer and the USBReceive on our brick is no problem unlike running
USBSend on the Pi. If we run it with the command “java
org/lejos/pcsample/usbsend/USBSend” we always get this error:

Code: Select all
Exception in thread "main" java.lang.NoClassDefFoundError:
lejos/pc/comm/NXTCommLogListener
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.getMethod(Class.java:1653)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException:
lejos.pc.comm.NXTCommLogListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more


We compiled it in eclipse trying every option, in the terminal on Windows,
Ubuntu, Debian and on the Pi (Raspbian) itself and in every case we got the same
error message. Even adding the pccomm.jar to the classpath didn’t solve the
problem.
Simple terminal based and GUI programs are working properly – so java shouldn’t
cause the problem. Running another lejos sample program ends up with:

Code: Select all
pcsamples/src/org/lejos/pcsample/tiltdemo/TiltDemo.java:2: error: package
lejos.nxt does not exist
import lejos.nxt.SensorPort;
^
pcsamples/src/org/lejos/pcsample/tiltdemo/TiltDemo.java:3: error: package
lejos.nxt.addon does not exist
import lejos.nxt.addon.AccelMindSensor;
^
pcsamples/src/org/lejos/pcsample/tiltdemo/TiltDemo.java:14: error: cannot find
symbol
AccelMindSensor a = new AccelMindSensor(SensorPort.S1);
^
symbol: class AccelMindSensor
location: class TiltDemo
pcsamples/src/org/lejos/pcsample/tiltdemo/TiltDemo.java:14: error: cannot find
symbol
AccelMindSensor a = new AccelMindSensor(SensorPort.S1);
^
symbol: class AccelMindSensor
location: class TiltDemo
pcsamples/src/org/lejos/pcsample/tiltdemo/TiltDemo.java:14: error: cannot find
symbol
AccelMindSensor a = new AccelMindSensor(SensorPort.S1);
^
symbol: variable SensorPort
location: class TiltDemo
5 errors


Maybe lejos isn’t set up correctly...
Hopefully you can help us.

Best wishes,
Baschdl
Baschdl
New User
 
Posts: 8
Joined: Fri Jul 05, 2013 8:29 pm

Re: Problems with leJOS on the Raspberry Pi

Postby skoehler » Mon Dec 23, 2013 7:02 pm

Sure I can help you. Let me know which command line exactly you use to run or compile your code and I tell you what's wrong about it. A ClassNotFoundException means that the classpath it not properly setup. The best thing is to install the Linux version of leJOS on the Pi itself. Then you can use the nxjpc command to run your programs that are supposed to remote control the brick. The nxjpc invokes the java command for you, but also adds the necessary JAR files into the classpath before running your application.
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Problems with leJOS on the Raspberry Pi

Postby Baschdl » Tue Dec 31, 2013 1:08 am

Thanks for your help, our fault was that we didn't use "ant" and "ant run" or a command like this:
Code: Select all
/usr/lib/jvm/java-7-openjdk-armhf/jre/bin/java -Dblank.dummy.arg= \
-Dnxj.home=/opt/leJOS_NXJ \
-classpath /opt/leJOS_NXJ/lib/pc/3rdparty/bcel.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/bluecove-gpl.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/bluecove.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/commons-cli.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/jcommon.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/jfreechart.jar\
:/opt/leJOS_NXJ/lib/pc/3rdparty/stax-api-1.0.1.jar\
:/opt/leJOS_NXJ/lib/pc/charting.jar\
:/opt/leJOS_NXJ/lib/pc/jtools.jar\
:/opt/leJOS_NXJ/lib/pc/pccomm.jar\
:/opt/leJOS_NXJ/lib/pc/pctools.jar\
:/home/pi/Desktop/pcsamples/build/classes org.lejos.pcsample.usbsend.USBSend



Greetings and a Happy New Year
Baschdl
Baschdl
New User
 
Posts: 8
Joined: Fri Jul 05, 2013 8:29 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron
more stuff