Entries for: LeJOS

GETTING STARTED WITH LEJOS & UBUNTU 8.10

Added on 2009-01-04 Under:

First download and extract the latest leJOS release. You can find the files here: leJOS Releases

If you don't have the latest Java JDK installed, open a new terminal and install it now.

ben@Akula ~ $ sudo apt-get install sun-java6-jdk

Now install ant, libusb-dev, & libbluetooth-dev

ben@Akula ~ $ sudo apt-get install ant libusb-dev libbluetooth-dev

The next step is to create an environment variable named NXJ_HOME that points to where you extracted the latest leJOS release and to append the lejos_nxj/bin directory to your PATH. Fire up your favorite text editor

ben@Akula ~ $ sudo nano ~/.bashrc

and add the following:

export NXJ_HOME="$HOME/development/lejos_nxj" # Path to lejos
export PATH="$PATH:$NXJ_HOME/bin"

Restart the terminal and check to make sure the NXJ_HOME & PATH variables are set.

ben@Akula ~ $ echo $NXJ_HOME
ben@Akula ~ $ echo $PATH

You should see something similar to this

/home/ben/development/lejos_nxj

and this

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/home/ben/development/lejos_nxj/bin

With the environment variables set, cd into the leJOS build directory

ben@Akula ~ $ cd $NXJ_HOME/build

Run ant to build leJOS

ben@Akula ~/development/lejos_nxj/build $ ant

Before you can flash your NXT, you'll need to add a udev rule to allow your account access to /dev/usb. I created a group named lego and added my user account to it. If you do this, you may need to log off and log back in.

Now fire up your favorite text editor

ben@Akula ~ $ sudo nano /etc/udev/rules.d/70-lego.rules

and add the following:

# Lego NXT (Make sure you set the group to what you want)
BUS=="usb", SYSFS{idVendor}=="03eb", GROUP="lego", MODE="0660"
BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"

With the rules created, restart udev so they take effect

ben@Akula ~ $ sudo /etc/init.d/udev restart

Test that the new rules are in place and try to flash your NXT

ben@Akula ~ $ nxjflash

That's it! Follow "Compiling and running your first code" in the leJOS README.html and be sure to run through the tutorials on the leJOS site.