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
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.
or… download the code from here.
[sociallocker]
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.
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.
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.
Miguel,
Can you provide the same details for a Mac side install? Thanks!
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.
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.
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?
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?
Pingback: Draw a Square: Using Motors in leJOS EV3 ← LEGO Reviews & Videos
Cool! Could you give us more tutorials on how to programming using Lejos? Can’t wait to read them!
I am on the way :)
Here you have the first part about motor handling… http://thetechnicgear.com/2014/05/tutorial-using-motors-draw-square-mindstorms-ev3-lejos/
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
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.
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 !
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
Are you using the same Java version? It really sounds like some kind of incompatible/missconfigured Java problem.
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
finally i resolved my problem. “project” “properties” “java compiler” and i change the level to 1.7.
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.
Nevermind I fixed it using the same fix as jos.fran
Used your tutorial to install the new Lejos release — thank you! Are you planning more Java tutorials?
Sure, I am planning a full leJOS tutorial… unfortunatelly real life got into the way. But I hope to return to work soon.
No problem — I under I have been reading generic Java programming material. And Brian’s new book. I just found your tutorials more helpful.
Pingback: LeJOS: el teu robot amb Java | Labs
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!