How to setup eclipse debugging for dummies

Hi guys,

I am new here, so first of all thanks a lot for all the awesome work that goes into this project!
I am really excited to start playing around with Openhab and to see what it is capable of.

What I wanted to do was to get an idea how Openhab 1.7 worked and debug a binding.
I setup the IDE following the “yoxos instructions” and got everything to build ok.
But I can’t for the life of me figure out how to start a debug sesssion.

My assumption is that I have to start the ./ script in the ./distribution/openhab folder and then connect with the eclipse remote debugger.
If this is true, my first problem is what I should set the eclipsehome variable to?
I tried setting it to my yoxos home path. But if I do that I am stuck at:
Listening for transport dt_socket at address: 8001

This is probabaly the time to confess that I am new to Java too, so this might be something competely obvious to somebody who knows what they are at.
I am also happy to read some primers on this subject if you have any good recommendations. I just don’t really know where to start at the moment.

Can somebody please give me a step by step guide for dummies to debugging a binding?

Thanks a lot!

1 Like

Ok, I think I figured out a way…

In case anybody else has a basic problem like this here is what I did.

I started from scratch according to the yoxos method.
After everything was setup according to the wiki page I copied the “openHAB Runtime” run configuration to create a “openHAB Runtime -Debug” configuration.

For the new configuration I added following options to the “VM options” field on the “Arguments” tab:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
(suspend=y will cause execution to stop until a debugger is attached).
Then I created a new remote debug configuration with the corresponding server settings (server: localhost port:8001).

And that is pretty much it!
To debug simply run the “openHAB Runtime - Debug” configuration and then start the “Remote Debug” session.

The configuration folder that is taken into account for this run is located here:

Hope that helps.

1 Like

Hi Narodo,

Thank you for this explanation. I am going to give it a try. Some things are not very clear to me, probably because I have not yet read the wiki page you are referring to.

Hi narodo,
Thank you for your detailed post.
I think I do the same thing as your post described in my eclipse,
However, I get this error message
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp

Actually I am pretty new to java. I think this problem may be trivial for expert java developer.

Thank you and any information will be greatly appreciated.