HOWTO Install leJOS 0.8.1 on LEGO Mindstorms EV3 22

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.

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.

Ads by Google

22 thoughts on “HOWTO Install leJOS 0.8.1 on LEGO Mindstorms EV3

  1. Reply Michael May 9,2014 2:47 am

    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.

    • Reply Miguel May 9,2014 9:44 am

      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.

    • Reply KMeyer Sep 26,2014 3:27 am

      Miguel,
      Can you provide the same details for a Mac side install? Thanks!

  2. Reply Michael May 10,2014 3:29 pm

    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. Reply Michael May 11,2014 8:29 pm

    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. Reply Michael May 11,2014 8:53 pm

    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?

    • Reply Miguel May 11,2014 9:16 pm

      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. Reply James Jun 27,2014 1:54 am

    Cool! Could you give us more tutorials on how to programming using Lejos? Can’t wait to read them!

  7. Reply Plenituz Jun 28,2014 11:51 am

    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

    • Reply Miguel Jun 28,2014 5:13 pm

      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.

      • Reply Plenituz Jun 28,2014 5:28 pm

        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 !

  8. Reply jos.fran Dec 16,2014 11:21 am

    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

  9. Reply jos.fran Dec 16,2014 6:42 pm

    i used your link for the java jdk 8.u25 and the jre7u60b19 as in your tuto.
    perhaps i made a mistake . i’m going to try again

  10. Reply jos.fran Dec 16,2014 8:25 pm

    finally i resolved my problem. “project” “properties” “java compiler” and i change the level to 1.7.

  11. Reply Mike Lorang Dec 21,2014 12:42 pm

    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.

  12. Reply Mike Lorang Dec 21,2014 12:46 pm

    Nevermind I fixed it using the same fix as jos.fran

  13. Reply Mike Wareman Jan 10,2015 11:44 pm

    Used your tutorial to install the new Lejos release — thank you! Are you planning more Java tutorials?

    • Reply Miguel Jan 11,2015 4:33 pm

      Sure, I am planning a full leJOS tutorial… unfortunatelly real life got into the way. But I hope to return to work soon.

      • Reply Michael Jan 11,2015 4:37 pm

        No problem — I under I have been reading generic Java programming material. And Brian’s new book. I just found your tutorials more helpful.

Leave a Reply