Developing with leJOS

Lawrie Griffiths

Developing with leJOS

The easiest way to develop programs for leJOS is to use the Eclipse plugin. Make sure you have installed the plugin -see [Installing the Eclipse plugin].

The first thing you need to do is to create a leJOS EV3 project. To do this you select File > New > Project... from the menu, and then leJOS EV3 > leJOS EV3 Project. Click Next and then give your project a name, and select Finish.

Expand your new project in the Package Explorer, select src and then right-click and select New > Package to create a Java package and select it. Then right-click and do New > Class to create a main class. It is a good idea to check the box that causes the main method to be created for you.

Add something to the main method, such as:

LCD.drawString("Plugin Test", 0, 4);

You can then run your main method by right-clicking of the class name, and selecting Run As > leJOS EV3 Program. Make sure your EV3 is switched on and the menu is running.

The plugin will create a runnable jar file for you, upload it to the EV3, and run it. You should see the message on the EV3 LCD.

You will see some messages in the leJOS EV3 Eclipse console view.

If you want to run your program using the Eclipse remote debugger, then do Debug As > leJOS EV3 program.

This should upload your program, and switch to the Eclipse Debug perspective and let you set breakpoints, step through your program and use the other debugging features of Eclipse.


EV3 Wiki: Getting started with leJOS EV3 (old)
EV3 Wiki: Getting started with leJOS EV3
EV3 Wiki: Home
EV3 Wiki: Installing the Eclipse plugin
EV3 Wiki: Working with GIT