In this project, I will show how to put the Lejos NXJ firmware on your NXT and load a simple program. Lejos is simply Java for NXT, so if you know Java, you can easily learn Lejos. Any version of the NXT will work. I will be working on Ubuntu 11.04, but if you are using any other system, it is still easy to figure it out. Good luck!
Modding Your Lego NXT: Programming the NXT Brick in Java
In this project, I will show how to mod the infamous Lego NXT to run the Lejos NXJ firmware, the NXT version of Java. Either version of NXT will work for this project.
After getting your materials, go to lejos.sourceforge.net and click on the “Downloads” tab under the “leJOS NXJ” link.
Once done with that, click the link under your OS to download it from Sourceforge. Choose the latest version in the menu that appears, and download the tar.gz inside.
Now, open the tar.gz file using Archive Manager or another program and extract the lejos_nxj folder. Move it to your home folder.
Once that’s there, type the following in terminal:
sudo gedit /etc/environment
and type in your password.
A gedit window will pop up. Add this to the end of PATH (inside the quotes):
An example would be PATH=”/usr/local/sbin:/usr/local/bin:$JAVA_HOME/bin:$NXJ_HOME/bin”. Now, add
JAVA_HOME=/usr/lib/jvm/java-6-sun-18.104.22.168 (or whatever it’s called, look in /usr/lib/jvm to find out) and
NXJ_HOME=/home/usernamegoeshere/lejos_nxj (or wherever you saved it). Now save, close, and move on to the next step. (Note, you might have to restart your computer)
While still in terminal, type the following:
and you’re done installing! You should see something that says “SUCCESS: ….” If you don’t, it means you set an environment variable wrong, and that you should go fix whichever one it is. To test that you installed correctly, type in nxj and you should get something that says “No classes specified.” If you do, great! You can move on.