Exception in thread “main” java.lang.NoClassDefFoundError: lejos/pc/comm/NXTConnector?

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

Moderators: imaqine, 99jonathan, roger

New User
Posts: 1
Joined: Sat Dec 10, 2016 1:32 pm

Exception in thread “main” java.lang.NoClassDefFoundError: lejos/pc/comm/NXTConnector?

Postby t.semwal » Sat Dec 10, 2016 1:36 pm

down vote
I am currently using java version "1.8.0_111" on a 32-bit linux 14.04 system and i'm getting this java.lang.NoClassDefFoundError:lejos/pc/comm/NXTConnector and i'm unable to solve it. I have set classpath, and following variables as follows in my .bashrc file

export PATH=$PATH:/home/rahul/Downloads/leJOS_NXJ_0.9.1beta-3/bin
export CLASSPATH=/home/rahul/Downloads/leJOS_NXJ_0.9.1beta-3/lib/pc
export NXJ_HOME=/home/rahul/Downloads/leJOS_NXJ_0.9.1beta-3
export LEJOS_NXT_JAVA_HOME=/usr/lib/jvm/java-8-oracle

and i'm getting this error for the file BTSend.java shown below for NXTConnector class.


and this is the error that i'm getting


User avatar
leJOS Team Member
Posts: 6001
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Exception in thread “main” java.lang.NoClassDefFoundError: lejos/pc/comm/NXTConnector?

Postby gloomyandy » Sat Dec 10, 2016 2:20 pm

What exactly is it you are doing? It seems you have included the BTSend sample app into some other program that you have built into a .jar file. Is this correct? What happens if you just run the BTSend sample without including it in your .jar? I suspect the problem is that you are using a .jar that needs a custom classpath. The nxjpcc command is really intended to be used to run simple leJOS PC programs that are compiled to class files and that are not in a .jar. As a result it uses command line arguments to set the classpath. If you want to use a .jar file with your program in it and still reference the leJOS .jar files then you will need to set the classpath property in your .jar file see:
https://docs.oracle.com/javase/tutorial ... wnman.html
http://stackoverflow.com/questions/1593 ... ath-option
leJOS news https://lejosnews.wordpress.com/

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 1 guest