leJOS Setup

What is leJOS?

leJOS is a firmware and application programming interface (API) that allows us to interface with the mindstorms robot using our programs written in Java. It allows us to be able to control and read values from all of the ports on the NXT brick, allowing us to write the programs to make the robot follow our commands.

Setup

The process to setup leJOS on your computer differs by operating system. Here I will be detailing resources that will help you set it up so we can be close to up and running on the first day!

Windows

Java Development Kit

If you already have the Java Development Kit installed, please uninstall your old version of the JDK and proceed with the instructions.

You will also need a Java Development Kit (JDK) on your PC. Note that a Java Runtime Environment (JRE) is not sufficient as it does not allow you to compile Java programs. You can download and install the latest JDK from here. Make sure to download the JDK labeled:

Windows x86 182.29 MB jdk-8u91-windows-i586.exe

You will be downloading the 32 bit version of java, as leJOS does not work with the 64 bit virtual machines.

NXT Fantom Driver

The next step is to download and install the NXT fantom driver. This will allow your computer to talk to the mindstorms controller.

leJOS Download

We now have to install lejos on your computer. Download here and follow the prompts for installation.

IDE Setup

Now it is time to download the integrated development environment (IDE). We will be using Eclipse during our camp because it is supported by the leJOS plugin. The downloads for the version of eclipse that is supported is found here (eclipse luna) (Eclipse IDE for Java Developers). Make sure to download the windows 32 bit version.  After installing Eclipse, please follow the guidelines to install. From here you need to install and setup the NXJ plugin following the instructions here.

Mac

If you have a mac, the procedure is slightly different because the newer OS’s of mac no longer support 32 bit JVMs.

Java Development Kit

You will also need a Java Development Kit (JDK). Note that a Java Runtime Environment (JRE) is not sufficient as it does not allow you to compile Java programs. A full JDK already ships with OS X or it can be installer on demand. Try the java and javac commands in the terminal to see whether a JDK is already installed. On OS X Lion, the commands will also show the instructions on how to installed the JDK provided by Apple. You will have to download this version from here.

Note: that even if you have a 64-bit system, leJOS will always chose to run java in 32 Bit mode by automatically passing the -d32 parameter to the java command whenever necessary.

NXT Fantom Driver

The next step is to download and install the NXT fantom driver. This will allow your computer to talk to the mindstorms controller.

leJOS Download

We now have to install lejos on your computer. Download here and decompress the tar file. Save the uncompressed folder in a new location and remember where you saved it.

IDE Setup

Now it is time to download the integrated development environment (IDE). We will be using Eclipse during our camp because it is supported by the leJOS plugin. The downloads for the version of eclipse that is supported is found here (eclipse luna) (Eclipse IDE for Java Developers). After installing Eclipse, please follow the guidelines to install. From here you need to install and setup the NXJ plugin following the instructions here.

Note: Make sure to set up the NXJ_HOME variable. You can do that by going to Eclipse-> Preferences-> leJOS NXJ -> Browse and then point it to the folder which contains the leJOS files you previously downloaded.

Starting Your IDE

Now you have to exit out of eclipse (quit). Now open up terminal and run eclipse from the terminal with the argument.

-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java

So the final command you run in eclipse should be

/{path to eclipse directory}/Eclipse.app/Contents/MacOS/eclipse -vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java

When you run eclipse this way, you should be able to run leJOS on your 64 bit mac.

Extra support and FAQs and more in depth tutorials can be found at http://www.lejos.org/nxt/nxj/tutorial/index.htm

If you are having trouble fixing these problems, don’t worry, we will help you set up the environment on the first day of camp. However, the earlier you set this up, the faster we can get to coding!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s