Problems linking Lejos Projekt with Netbeans plugin

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

Moderators: 99jonathan, roger, imaqine

Problems linking Lejos Projekt with Netbeans plugin

Postby fichtner » Mon Nov 23, 2009 10:44 pm

When i link with Netbeans ans build.xml
i get the following Message
Code: Select all
clean:
Deleting directory C:\Users\Fichtner\Documents\NetBeansProjects\test\build
compile:
Created dir: C:\Users\Fichtner\Documents\NetBeansProjects\test\build
Compiling 1 source file to C:\Users\Fichtner\Documents\NetBeansProjects\test\build
link:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
        at js.tinyvm.TinyVM.<init>(TinyVM.java:44)
        at js.tinyvm.TinyVM.main(TinyVM.java:28)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 2 more
Java Result: 1
ERSTELLEN ERFOLGREICH (Gesamtzeit: 0 Minuten 0 Sekunden)


Thanks alot
Michael
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Mon Nov 23, 2009 11:08 pm

Hi,
Please tell us...
What version of leJOS?
What version of NetBeans?
What operating system?
What version of Java?
Have you been able to build and run leJOS programs from the command line?
Are you using the leJOS Netbeans plugin? If so where did you get it and what did you do to install it?


Then provide us with details of exactly what you have done to create your project including and configuration etc.

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

Postby fichtner » Mon Nov 23, 2009 11:47 pm

Sorry i dont share the Data

What version of leJOS? 8.5
What version of NetBeans? 6.7.1
What operating system? Win 7
What version of Java? jdk1.6.0_16

Have you been able to build and run leJOS programs from the command line?

- I haven´t tried

Are you using the leJOS Netbeans plugin?

- Yes

If so where did you get it and what did you do to install it?

- I installed the Install.Exe

- in there it was no Plugin so i
- copied the ZIP File on top
- and Installed it with success in Netbeans
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Tue Nov 24, 2009 1:25 am

Hi,
well the first thing to do is to make sure that the command line tools work. So try building one of the sample projects using them. Go the the hello world sample and compile it using
Code: Select all
nxjc HelloWorld.java

Then link is using
Code: Select all
nxjlink -v HelloWorld

Now try to run it (turn on your nxt)...
Code: Select all
nxj -r HelloWorld


If all that works. Try doing the same thing in NetBeans. Open the Samples project, then select HelloWorld, right click on the build.xml file and select RunTarget->uploadandrun

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

Postby fichtner » Tue Nov 24, 2009 9:54 pm

Ok, i have forgotten that the Path variable
has to point to the Lejos-bin dir

Now the manuel kompilation executes

But the Linking creates the following
Code: Select all
C:\Program Files\leJOS NXJ\projects\samples\HelloWorld>nxjlink -a  HelloWorld -o
 HelloWorld.nxj
Bug RT-1: Written=1236 Length=1224 Class=js.tinyvm.RecordTable
js.tinyvm.TinyVMException: Bug RT-1: Written=1236 Length=1224 Class=js.tinyvm.Re
cordTable
        at js.tinyvm.RecordTable.dump(RecordTable.java:156)
        at js.tinyvm.Binary.dump(Binary.java:80)
        at js.tinyvm.TinyVMTool.dump(TinyVMTool.java:128)
        at js.tinyvm.TinyVMTool.link(TinyVMTool.java:52)
        at js.tinyvm.TinyVM.start(TinyVM.java:100)
        at js.tinyvm.TinyVM.start(TinyVM.java:85)
        at js.tinyvm.TinyVM.main(TinyVM.java:30)
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Tue Nov 24, 2009 11:12 pm

Hi,
What happens if you don't use the -a option (in general you shouldn't use that option)...

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

Postby fichtner » Wed Nov 25, 2009 12:35 am

now the linking is ok
but the upload fails

Code: Select all
C:\Program Files\leJOS NXJ\projects\samples\HelloWorld>nxjlink HelloWorld -o Hel
loWorld.nxj
C:\Program Files\leJOS NXJ\projects\samples\HelloWorld>nxj -r HelloWorld
leJOS NXJ> Linking...
leJOS NXJ> Uploading...
leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Searching for any NXT using Bluetooth inquiry
leJOS NXJ> Search Failed: BluetoothStack not detected
leJOS NXJ> Failed to find any NXTs
leJOS NXJ> Failed to connect to any NXT
an error occurred: No NXT found - is it switched on and plugged in (for USB)?
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Wed Nov 25, 2009 1:37 am

Hi,
Here are some things to check...

Do you have a 64bit JVM?
Your JVM must be 32bit not 64bit... The easy way to be sure is to uninstall your JDK and to re-install making sure you choose the 32 bit version not the x64 version.

When you installed leJOS did you download the firmware to the NXT? Did it work?

Do you have the Lego software installed? Can you use that to talk to your NXT over USB?

Can you run the nxjbrowse command? What happens?

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

Postby fichtner » Wed Nov 25, 2009 8:02 am

Do you have a 64bit JVM?
Your JVM must be 32bit not 64bit... The easy way to be sure is to uninstall your JDK and to re-install making sure you choose the 32 bit version not the x64 version.

- The normal Java Kompilation works, so - i think i have 32bit
- I Installed it included in the Netbeans Package

When you installed leJOS did you download the firmware to the NXT? Did it work?

- Yes

Do you have the Lego software installed? Can you use that to talk to your NXT over USB?

- Yes
- but how can i check this with Lejos?

Can you run the nxjbrowse command? What happens?

Code: Select all
C:\Windows\system32>nxjbrowse
leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Searching for any NXT using Bluetooth inquiry
leJOS NXJ> Search Failed: BluetoothStack not detected
leJOS NXJ> Failed to find any NXTs
No NXT found - is it switched on and plugged in (for USB)?


In the Device-Manager the NXT is listed as a Lego Device
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Wed Nov 25, 2009 8:17 am

If you have the 64 bit version of Windows 7 then my guess is that you have the 64bit JVM... That is the normal cause of the problems you are seeing. The native code supplied with leJOS is 32bit and will not work with a 64bit VM...

Did you install (or update) NetBeans before or after leJOS? If after you probably had a 32bit version when you installed leJOS but now have a 64bit version.

I'm also confused about you having to modify your path variable manually. This normally gets set by leJOS during the install. Did you install leJOS normally? Did you make any changes after the install? IS this a clean windows 7 install?

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

Postby fichtner » Sun Nov 29, 2009 12:16 pm

After your answers are pointing in the installations direction
i decided to reinstall the components.

I downloaded the newest components and installed it
at Win 7, Win XP (2 different PC´s) and it is always the same
result.

- Java compilation in Netbeans is successfull
- The PATH enivromentvar isn´t automatical set
- The Netbeans plugin isn´t in the Installation file from Lejos
- i have to copy the ZIP over the Lejos Installation to get the plugin
- Loading the Lejos HelloWorld example shows errors about the
Lejos library
- Pointing in Netbeans to the Lejos LIB dir takes no efffect
- Copying it in the JRE /ext/lib dir solves the Problem but ...
- Linking creates errors (look discribing early in this post)

In my opinion, this is too much trouble for me, at one time.
And i don´t know to start with

I think the new components could be a little be buggy
(because of the marker "beta") and not so user-friendly
as they should.

My Problem now is, that I don´t know if it is gone with the next release ?!?!?

But at all, many thanks to "gloomyandy" for your great and fast support!!!!
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby gloomyandy » Sun Nov 29, 2009 2:48 pm

Hi,
I'm not sure what is going on here, here are a few comments...
1. The leJOS install will normally set your path to include the leJOS bin dir. However you may need to run the command with administrator rights for it to do this. You may want to check your path and remove any errors from it (or old references to leJOS), before installing leJOS.
2. The NetBeans plug in is not part of the standard install (nor is the Eclipse plug in), so will need to be installed separately.
3. The NetBeans plug in is very new, and is still being developed, so you may see problems with it.
4. You don't need the plug in to use NetBeans with leJOS (though it can make things easier).
5. You should probably take things a step at a time ensuring that each step works, rather than installing lots of things then trying to make it all work...

I think you need to start again from the very beginning, and for now I would ignore the NetBeans plug in, you do not need this to build programs in NetBeans...

1. Remove leJOS
2. Remove Netbeans
3. Remove the JDK.
4. Make sure you have the Lego software installed. If it is not the 2.0 version download and install the correct driver from here:
http://www.robotc.net/download/nxt/
5. Install the 32bit version (not the X64) version of the JDK (and not the version combined with NetBeans).
6. Ensure that the bin directory of the JDK is in you path, and that you can open a cmd window and that the command javac -version works.
7. Download and install leJOS.
8. open a new command window and cd into the lejos samples that you have just installed. cd to the HelloWorld sample.
9. Connect your NXT using USB and compile and run the sample with:
nxjc HelloWorld.java
nxj -r HelloWorld
10. If the above all works then you have a basic leJOS system working. I have just followed all of the above steps on my system and it all works. The path has been set correctly and I can run the command line lejos tools with no problems (and without setting the path manually). If the above does not work, stop now and report the problem.
11. Install NetBeans I would recommend that for now you use 6.5.1 as more recent versions seem to have a pre-compiler that gets confused by leJOS.
http://netbeans.org/downloads/6.5.1/index.html
12 Run netbeans and open the leJOS samples project.
13 Turn on your NXT, compile and run the hello world sample by opening the sample, click on default package, right click on the build.xml file and select run target->uploadandrun
14 The above should work and on my system no errors are flagged by netbeans. If you have problems please report them.

I would stop there. You can create your own projects by creating a copy of the build files used in the samples directory (you may need to change the path information but this is easy to do). You may need to take a while to understand how the ant build process works, but in the long run I think it will be worth it....

I've just followed all of the above steps on couple of clean systems (Vista and Windows 7 on both systems my user was a member of the admin group and I had the standard settings for UAC) here and it seemed to work fine for me. Please try the above, please don't be tempted to miss out any of the steps....


Once you have the above working, and you can build and run the samples. You may wish to try the NetBeans plug in. but I probably can't help you very much with that. But Roger (the author of that part of the project probably can)....


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

Postby gloomyandy » Sun Nov 29, 2009 6:33 pm

Hi,
I've edited my previous post to add a few extra comments, so you may need to read it again!

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

Postby fichtner » Tue Dec 01, 2009 7:41 am

Thank you for your detailed walkthroug.

I think i will do this step by step
and report it to you ...
fichtner
New User
 
Posts: 7
Joined: Mon Nov 23, 2009 10:39 pm

Postby nargzul » Fri Mar 19, 2010 5:18 pm

I've installed same version of netbeans and the plugin.

I've no problem to nxjc/nxj manually, but when I try to do this with the netbeans script, it first don't find the classes.jar. I corrected this.

But now I get this error:

clean:
Deleting directory C:\Users\Lejos\Desktop\LejosProjects\TestNXJ\build
compile:
Created dir: C:\Users\Lejos\Desktop\LejosProjects\TestNXJ\build
Compiling 2 source files to C:\Users\Lejos\Desktop\LejosProjects\TestNXJ\build
link:
java.lang.NoClassDefFoundError: js/tinyvm/TinyVM
Caused by: java.lang.ClassNotFoundException: js.tinyvm.TinyVM
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: js.tinyvm.TinyVM. Program will exit.
Exception in thread "main" Java Result: 1
uploadandrun:
java.lang.NoClassDefFoundError: lejos/pc/tools/NXJUpload
Caused by: java.lang.ClassNotFoundException: lejos.pc.tools.NXJUpload
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: lejos.pc.tools.NXJUpload. Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)


Have you an idea?
nargzul
New User
 
Posts: 1
Joined: Fri Mar 19, 2010 5:11 pm

Next

Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

more stuff