How to attach a debugger to my library?

edited July 2014 in Questions about Tools

Hi all,

I have started to develop my own library following the official tutorial in the wiki. Everything works fine and I can see some simple results. However, I would like to be able to step into my code and set breakpoints in Eclipse. What is the best approach for that?

Yet, I have installed Proclipsing and successfully started my project from inside of the Eclipse. I am able to debug the content of the setup() and draw() methods, however when I try to step into my library, there is no source available. Also when I set breakpoints inside of my library, Eclipse reports that there are line number annotations missing (despite of being switched on in the properties). I have tried to connect to the debugger remotely to the Ant script , but the error reported was that there is no main() entry point. I assigned the -Xrunjdwp attribute to the main class of my library. Should I attach it to the main Processing class? If true, which one is it and how can I change the build script to do so?

Thank you in advance for any hints :)



  • Answer ✓

    In theory, in Eclipse, in Java Build Path dialog, Libraries, you can define the location of the source files for each library.

  • Answer ✓

    I assume that in Eclipse you have one 'project' for the library and you are using Proclipsing to create test 'sketches'.

    If that is the case then in your test sketch project right click on the project name and select

    Build Path > Configure Build Path

    from the popup menu.

    Click on the libraries tab then locate and remove the entry for your library jar.

    Now click on the projects tab then select and add your library project.

    The test sketch will use the library project source code when running so you can set breakpoints in the library.

  • Thank you for your answers, they really helped :) I have successfully hit the first breakpoint after combining both of them. I have added the library project to the projects tab in the build path of the sketch, but not removed it (otherwise it threw an error). I have then added the source folder and the native library path to the settings of the referenced library.jar (after unfolding its context menu). Happy debugging may start ^^

    cheers Isolin

Sign In or Register to comment.