Lejos NXJ module for NetBeans

Legal notice : use at your own risk

 

Installing the module

This was very simple, but things evolve {lejos version {04.,0.5,0.6…}}, I still have legacy code running on Lejos 0.4 which I don’t want to upgrade because  I would have to re-calibrate a whole set of experiments.

But students want the wackiest new features.. so here goes, there is now a plugin for each version {original0.4,0.4,0.5,0.6,0.6mac} including the mac variant for 0.6 (don't forget to install the software which came on cd withe the robot, install libusb (i got mine from http://www.ellert.se/twain-sane/), and build your version of downloaded LeJOS).

Thanks to:
Ruslán Ledesma Garza and F.vanSlooten for comments re Windows Vista which should have been fixed
and Yann Donnelly for pointing out how out of date I was getting :-)


Follow the instructions below, either choosing the original file or one of the newer plugins.

 

 

The module is very simple and allows Java applications to be developed in NetBeans which can then be uploaded and run.
It creates a template with links to the NXJ files and an ANT script which does most of the work for you

 

Pre-requisite: you have installed and have working the Lejos software (version 0.4 through to 0.6)

Lejos downloadable from http://lejos.sourceforge.net/

It now works with NetBeans 6.0 beta 2 :-( used to crash it! )

 

Step 1: Download one or more of  the files: org-dHb-lejosnxt.nbm org-dHb-lejos-nxt0_4.nbm org-dHb-lejos-nxt0-5.nbm org-dHb-lejos-nxt0_6.nbm org-dHb-lejos-nxt0_6mac.nbm

Step 2: In NetBeans click on 'Tools->Update Centre'

Step 3: Click on the radio button 'Install manually downloaded modules (.nbm Files)'

Step 4: Click on 'Next' and then click on the 'Add' button to find the downloaded file

Step 5: Click on the 'Next' etc accept the defaults

Step 6a: On Linux, I have had problems with the NXJ_HOME, to overcome this the module now require the following : Tools->Options->Miscellaneouse->ANT->Manage Properties

Step 6b: Add a line nxj.home=???? (if you want a generic lejos home or location)

NB windows users should use forward slashes to seperate folders (not the back slash as is normal) e.g. nxj.home=c:/lejos_nxj

I hate inconsistencies between platforms, so I have chosen the above stratergy for all platforms (it was far nicer when the environment variables were passed through!)

UPDATE 2nd Nov 2007: I have altered the build.xml to check if the environment variable NXJ_HOME is available to the script, in which case, you will not have to set the property as described above. Any answers as to how to get the environment variables in Linux using NetBeans would be appreciated!

If you do set the nxj.home property as described above, it will take precedense over the environment variable.

UPDATE 23rd Sep 2008 ADVANCED!

Because of the ability to program against different versions, you may need to set different paths to each lejos download

Step 6c: or us nxj.home0_4 for a specific lejos version e.g. nxj.home0_4=/lejos4/lejos_nxt/

You can also target a specific robot to upload to:

Step 7 : If you want to target a specific machine, add another line nxj.robot.name=Bob (NB replace Bob with the name of your robot), this will cause the files to be sent to the robot of the same name

 

Running programs

'File-> New Project'

Catagories = Samples->java= NXJ..

Once the project is created, you can clean, build, run (and emulate if you are using Linux and run targets from the build.xml file) using the normal buttons|menus you would have to use with a normal java app development.

 

ONE PROBLEM

1. The project may need renaming once created

Have fun. :-)

 

David Bowes: University of Hertfordshire

 

If you want to e-mail me about the NetBeans Module, please use the link below and DON'T change the subject
d.h.bowesherts.ac.uk