HOWTO Install leJOS 0.8.1 on LEGO Mindstorms EV3

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.

lejos-workin-on-ev3-arm-java

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

Install LeJOS

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.

Install Eclipse

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.

Screenshot-6

or… download the code from here.
[sociallocker]
java-6 Java Source Code file
[/sociallocker]

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.

Miguel says…

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.

24 thoughts on “HOWTO Install leJOS 0.8.1 on LEGO Mindstorms EV3”

  1. Your tutorial helped me a lot! I now need some help using Eclipse to create a program and the upload it to my robot. I am very new to Java and just learning the basic concepts.

    1. Mainly…
      1) Create a New Project -> leJOS EV3 Project
      2) Add New Class and name like you want, make sure it has static public main method
      3) Copy the code on the article
      4) Click on class name and Run -> leJOS EV3
      5) You should see Hello World on the EV3 Brick.

  2. I have written a program but now having troubles uploading it to the robot. How do I setup Eclipse to use the WiFi to upload the program? I have an IP address from the WiFi.

  3. I found the EV3 Control Center and then figured out how to search and connect to the robot. Next trick is to figure out how to get my program onto the robot. Any help would be greatly appreciated.

  4. Once the robot is connected through the EV3 Control Center that is all that is needed. When you go to run the program it gets uploaded to the robot. Thank you for getting me started. Would you be interested in a tutorial based on my experience?

    1. Sure.
      Anyway… I really don’t understand the problem. Once you configure the WiFi on the robot and you click on Run As -> leJOS everything goes automatically. Isn’t it?

  5. Pingback: Draw a Square: Using Motors in leJOS EV3 ← LEGO Reviews & Videos

  6. Hey ! I tried installing leJOS just like you explained, it looked like it installed correctly (leJOS screen saying installing linux fs …) but when I looked at it after a while it was on the mindstorm screen. However my SD card has been formated like you said with another partition. What did I do wrong ? Thanks

    1. My advice is remove all partitions on the SD card, using Disk Manager and try it again. Sometimes shit happens. If it still happens drop me a line and we can work how to fix it.

      1. I have been reading the forum and it looks like the SDcard is “broken” (even though it works fine for other usages) so I have to buy another one which is no big deal, thanks for the tuto !

  7. Hey !
    I’am french and i’ll try to explain my problem.
    after run your “hello word” program in my EV3 brick i got an error message on the console EV3 :” java.lang.UnsupportedClassUsers”
    i respected your tuto . i used eclipse luna the last version.it’s the only difference with you
    i don’t know what to do now ?
    thanks for help

  8. Hi, thanks for your video, I have a Problem tho with uploading my program to the ev3. It uploads perfectly, but i an exception: Unsupported Class Version Error 52.0. Run it in eclipe with jdk 7.

  9. Pingback: LeJOS: el teu robot amb Java | Labs

  10. Hey!
    Im trying to install the LeJOS Eclipse Plugin and it doesn’t seem to work with the link that was given. I believe it is something about a new website you are making or such. Is it still possible to install the plugin some other way?
    Thanks!

Leave a Comment