Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

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.

Modding Your Lego NXT: Programming the NXT Brick in Java

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!

Steps

Step #1:

PrevNext
Modding Your Lego NXT: Programming the NXT Brick in Java
  • 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.

Step #2:

PrevNext
Modding Your Lego NXT: Programming the NXT Brick in Java
  • 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):
  • :$JAVA_HOME/bin:$NXJ_HOME/bin
  • 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-1.6.0.24 (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)

Step #3:

PrevNext
Modding Your Lego NXT: Programming the NXT Brick in Java
  • While still in terminal, type the following:
  • cd /home/yourusernamegoeshere/lejos_nxj/build
  • ant
  • 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.

blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,882 other followers