LeJOS is a programming environment to program your LEGO Mindstorms robot using Java. Yes, Java. Yes, that means real variables, arrays, bluetooth, TCP/IP, files, etc… Stop drooling and read with me how to install it on the EV3 brick.
You can watch the videotutorial about how to install LeJOS in the EV3 brick
Install Java JDK
I had some problem installing the software, so I really wanted to write a tutorial that would allow all of us install it. So, first stuff is… download the Java JDK. If you are a Java Developer you will surely have this installed on your system. http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp
Once you have download the Java JDK you need to download the JRE for the Mindstorms, so go to Oracle page and get it. It is important to download the JRE and not the JDK or it won’t
work straight with the installer. http://www.oracle.com/technetwork/java/embedded/downloads/javase/javaseemeddedev3-1982511.html
Ok, go and download LeJOS software. Install it and once click on source code and samples, you may need it to improve your skills with LeJOS. So once the installation is complete it is time to create a SD card to boot the EV3 brick, so get a empty FAT32 formated MicroSD card with at least 2GB of memory. You know what they say, the more the better.
Ok, so now just click on the folder where you downloaded the Mindstorms JRE and let the card be built.
Eclipse is one of the best IDE for Java development that I have tried. It doesn’t has any of the Netbeans fancy GUI editors but it is damn lighting fast. And it is portable. Just unzip it on your computer and click on Eclipse app.
Install LeJOS Eclipse plugin
This plugin will make extremly simple to run your apps in the brick, just click on Window and choose Add new software, click on Add, fill LeJOS plugin URL ( http://lejos.sourceforge.net/tools/eclipse/plugin/ev3 ) and click to install. It will ask you to restart Eclipse.
After restarting, click on Edit –> Preferences and choose LeJOS EV3. Now Configure the path where the main LeJOS installation is and you are done.
Boot the EV3 brick
Ok, time to boot the brick. Place the SD card and optionally the WiFi dongle and boot it up. The installation time is around 10 minutes so give it a break…
When it it is done you should see the LeJOS menu, so before continuing please take a minute and configure your EV3 Brick WiFi ( no more messing USB cables ).
Write your first program
Ok, time to use LeJOS. This is not a tutorial about how to use LeJOS so I will keep the sample to a minimum so you just know the installation works. If there is interest I can write a deeper article about how to use LeJOS to program your robots with real cases.
So create a new Eclipse LeJOS EV3 project, add a class with main method and paste this code in the Main method.
or… download the code from here.
Don’t forget the import declarations.
Finally right-click on the class name and Run it as > LeJOS EV3. On the console it should appear that the brick has been found and you should see the Hello World message after a few seconds on the brick. Be careful with the firewall, as you can see on the video it was blocking the EV3 Brick connection.
HOWTO Connect EV3 in leJOS using USB
The above tutorial is based around a little cheap Wifi dongle, but if you don’t have one and still want to live in a world of messy cables please check here what you need to do to get USB working, it is pretty much the same that the above tutorial but you need to configure a Windows devide ( Remote NDIS ).
Ok, the idea is to install a Microsoft Corporation Driver for Remote NDS Compatible Device so that the our USB EV3 appears as a new network on the computer. Once it is done, I just tested it with a ping and then I launched the program.
Java really opens a whole new world in robotics programming where EV3 Software can’t reach. If you had any other problem that I didn’t address drop me a comment and we will try to sort it out.