How to debug a mock


I’m developping a mock for my platform following your documentation available here and wonder how to debug my mock. Is it possible to do it ?

Best regards,

Jean Morin

1 Like

Hello Jean,

Yes it is possible !

You can follow those steps to debug a mock, assuming that you already have a platform imported in your workspace and a mock of your project:

  • In your platform sources, enable HIL debugging:

    • Open the scripts/hil.xml file

    • Copy the following line.

      <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,suspend=y,server=y,address=8000"/>

    • Add it under the VM lauching HIL Engine part:

  • Increase the connection timeout between the simulator and the HIL engine:

    • Go to Run -> Run Configurations

    • Go to the Simulator section of the Configuration tab and increase the HIL connection timeout:

  • Put a breakpoint in your mock-up code

  • Run your application on the simulator

  • You should get in the Console:

    =============== [ Initialization Stage ] ===============
    =============== [ Launching on Simulator ] ===============
    Listening for transport dt_socket at address: 8000
  • Attach a Java standard debug launcher:

    • In the package explorer, select your mock-up project
      • Go to the Run > Debug Configurations... menu

      • Double click on Remote Java Application

      • Let the default options:

      • Click on the Debug button

  • You should get stopped in you mock-up code:

Let me know if you have any troubles completing those steps.

Best regards,


1 Like

Hey I’m trying to create my mock and I’m following the example here, but I had this issue and I saw this topic about debugging on mock, but when I try to run the debug I’m getting this message

Hi @ricardobna,

It could happen that a Mock is still running in the background not properly closed and is still listening on the port. Then when you start the debug again you cannot access this port.
Also be aware that since you are listening on certain ports some Windows firewall configuration on your PC may apply.

Best Regards,
Gaëtan for MicroEJ