Debug an Application

Note

This page is releated to the version 5 and lower of the SDK. If you use the SDK 6, please refer to the page Debug on Simulator.

Debug on Simulator

To debug an application on Simulator, select it in the left panel then right-click and select Debug As > MicroEJ Application.

MicroEJ Development Tools Overview of the Debugger on Simulator

MicroEJ Development Tools Overview of the Debugger on Simulator

Debug on Device

To debug an application on device, first run the MicroEJ debugger proxy, and run a Remote Java Application launch:

  • Go to Run > Debug Configurations > Remote Java Application
  • Set the informations about the project to debug, the proxy connections properties, etc.
  • Click on Debug
MicroEJ Development Tools Overview of the Remote Java Application Launch

MicroEJ Development Tools Overview of the Remote Java Application

In the SDK, open the Debug perspective (Window > Perspective > Open Perspective > Other… > Debug) to show the current debugging process.

MicroEJ Development Tools Overview of the Debugger on Board

MicroEJ Development Tools Overview of the Debugger on Board

It makes use of Eclipse Java debugger client. If you are unfamiliar with Java debugging or Eclipse IDE, see Debugging the Eclipse IDE for Java Developers to get started.

You can also debug with IntelliJ IDEA. For more information on IntelliJ IDEA Remote debug process, see IntelliJ IDEA Remote debug

Get Library Sources

All libraries included in MicroEJ SDK are provided with their source code and resources. The way the sources are retrieved depends on the kind of library (Add-On Library or Foundation Library).

Add-On Library Sources

Add-On Library sources are packaged in a dedicated file named [module_name]-source.jar available in the module directory:

Add-On Library Sources Location

Add-On Library Sources Location

In the SDK, sources are automatically connected to Eclipse JDT when the new Add-On Library is added as a module dependency.

On any Java element (type, method, field), press F3 or CTRL-Click to open the implementation:

Add-On Library Open Implementation

Add-On Library Open Implementation

Then the implementation class is open in read-only mode.

Add-On Library Read-Only Source Code

Add-On Library Read-Only Source Code

Foundation Library Sources

Foundation Library sources are directly included in the implementation file (JAR file) provided by the Platform.

They are located in the following Platform folders:

  • javaLibs for generic Foundation Libraries (defaults).
  • MICROJVM/javaLibs for Foundation Libraries specific to the MicroEJ Core Engine.
  • S3/javaLibs for Foundation Libraries specific to the Simulator.
Foundation Library Platform Folders

Foundation Library Platform Folders

In the SDK, sources can be connected while debugging an Application on Simulator. This ensures to get the exact source code which is executed on your Platform.

Here are the steps to attach Foundation Library sources from a Platform loaded in the workspace:

  • Open a MicroEJ Application launch,

  • Select the Source tab (see also Source Tab),

  • Click on Add… button,

  • Select Archive item and press OK,

    Add Foundation Library Sources to MicroEJ Application Launch

    Add Foundation Library Sources to MicroEJ Application Launch

  • Select the Foundation Libraries from Platform folders and press OK,

    Select Foundation Libraries Implementation Files

    Select Foundation Libraries Implementation files

    Warning

    You must select the libraries from the Platform project corresponding to the execution Platform (see Execution Tab).

In the debug session the implementation sources will be now displayed.

Foundation Library Read-Only Source Code

Foundation Library Read-Only Source Code