Using the Eclipse plugin

Lawrie Griffiths
Attachments
preferences.png (57231 bytes)

Using the Eclipse plugin

The recommended way to develop program for leJOS EV3 is to use the leJOS EV3 Eclipse plugin.

If you do not already have a working Eclipse IDE, you should download Eclipse from http://www.eclipse.org/downloads/.

The recommended version of Eclipse is the Eclipse IDE for Java Developers.

Once you have started Eclipse, you will need to install the leJOS EV3 Eclipse plugin. You do that by selecting Help from the menu and then "Install New Software...".

Click the Add... button to add the leJOS EV3 repository.

The repository URL is http://lejos.sourceforge.net/tools/eclipse/plugin/ev3 and you should give it a suitable name such as leJOS EV3.

You should then click the check box and install leJOS EV3 support.

Alternatively you can search for leJOS EV3 in the Eclipse Marketplace and install it from there.

It will ask you to accept the license, will tell you that the plugin has not been signed and will then ask to restart Eclipse. Once Eclipse has restarted, the plugin should be available and you will see menu items and icons for it.

The first thing you need to do is to set EV3_HOME is the preferences. To do this click the Windows menu and select preferences and then leJOS EV3. You should see

You should set EV3_HOME to your installed version of leJOS EV3 as in the picture.

You should leave "Run Tools in separate JVM" set, and "Use ssh and scp" unset. It is a good idea to set
"Run program after upload".

The next think 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);
Delay.msDelay(5000);
~~~~~

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.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks