Debug an Application

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

MicroEJ Development Tools Overview of the Debugger

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.

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