debugging Moneydance extensions in Eclipse

Timothy S.'s Avatar

Timothy S.

07 Sep, 2013 11:12 PM

Hi. I am new to developing Moneydance extensions. From the forums and documentation that I have read, it appears that no one has published a HowTo on debugging a Moneydance extension with a graphical debugger, such as Eclipse or Netbeans. I think that this is a very significant gap in the development of extensions to your product.

I have successfully configured editing and Ant building of a Moneydance extension with Eclipse Kepler on Windows 8 64-bit. However, when I attempt to launch Moneydance via the moneydance.jar, both "default package" and Main will run, but not bring up the graphical application.

I am thinking that running Moneydance in the Java debugger (with no visibility into its source), but with visibility into the source of an extension (where source is available) is a very reasonable expectation. I am assuming that this is quite possible, but that it is only known by several people; hence the lack of documentation.
Does anyone reading this forum know how this can be done, and care to share that information?
I would be happy to write a tutorial for developing Moneydance extensions with Eclipse as I learn the process.

Thanks.

Tim S.

  1. 1 Posted by mennesoft on 08 Sep, 2013 06:15 PM

    mennesoft's Avatar

    Hello Tim,

    Yes, you can debug your extension and step through your code. The key thing
    to do is to bind your debugger to the actual Moneydance.jar that the
    application is using, instead of just the extension API jar.

    I use IntelliJ IDEA. I added two Libraries to the project:
    1. "Moneydance Installed" = all the jars in C:\Program Files\Moneydance\jars
    2. "Extension Dev" = extadmin.jar, not really needed to compile but used in
    signing the .mxt

    Then I setup the runtime settings for debugging like so:
    Main class: Moneydance
    VM options: {blank}
    Program arguments: {blank}
    Working directory: C:\Program Files\Moneydance\jars

    I wrote the build script to automatically copy the newly built and
    locally-signed jar to ${install}=C:\Users\{user_name}\.moneydance\fmodules

    Then after compiling the first time and installing the .mxt in Moneydance,
    subsequent runs could be made in the debugger. I pretty much build all the
    time from the command line because you have to enter a password for the key
    to sign the .mxt, and I've never figured out a good way to do that in
    IntelliJ. After building on the command line, I just flip back to IntelliJ
    and run, and now the code IntelliJ sees matches the code running in the
    .mxt.

    The sign and copy of the .mxt in the Ant script looks like this:
        <java newenvironment="true"
          classpathref="extclasspath"
          classname="com.moneydance.admin.KeyAdmin">
          <arg value="signextjar"/>
          <arg value="${extprivkeyfile}"/>
          <arg value="${extprivkeyid}"/>
          <arg value="handybank"/>
          <arg line="${extdist}/handybank.mxt"/>
        </java>
        <delete file="${extdist}/handybank.mxt" verbose="true"
    failonerror="false" />
        <move file="./s-handybank.mxt" tofile="${extdist}/handybank.mxt"
    verbose="true" failonerror="false" />
        <copy file="${extdist}/handybank.mxt" tofile="${install}/handybank.mxt"
    verbose="true" failonerror="false" />

    Good luck!

    --Kevin
    Author of the Find and Replace, HandyBank and Ratios extensions, major
    contributor for the Quotes and Exchange Rates extension

  2. 2 Posted by Tim S. on 08 Sep, 2013 09:53 PM

    Tim S.'s Avatar

    Thank you Kevin.

    I had already setup Eclipse to do exactly that, except that I wasn't setting the working directory for java to run from (C:\Program Files\Moneydance\jars), and I had moneydance-dev.jar in the classpath in addition to the main moneydance.jar.

    After setting the working directory and removing moneydance-dev.jar all together, I still get the same error. Here are the details.

    Moneydance prints:
    loaded helper: class com.moneydance.apps.md.controller.platforms.DefaultHelper

    I assume that it is not detecting that it needs to load:
    com.moneydance.apps.md.controller.platforms.WinHelper

    The debugger immediately catches an exception and breakpoints on the Moneydance class (no source) with the following details:
    Thread [main] (Suspended (exception NoSuchMethodError))

    Tim S.

  3. 3 Posted by Tim S. on 08 Sep, 2013 10:18 PM

    Tim S.'s Avatar

    I have the debugger triggering on breakpoints in the extension source.

    In: Run | Debug Configurations ... | Moneydance | Classpath

    It was necessary to re-add all of the Moneydance application jars to the "User Entries" classpath list, and order them ahead of the extension under development, in this list.

  4. 4 Posted by mennesoft on 09 Sep, 2013 12:03 PM

    mennesoft's Avatar

    Yes, for the record, *all* the jars need to be added from the /jars folder
    so you don't run into NoSuchMethod exceptions. Here's the list as of a
    recent build:

    antlr-3.2.jar
    appsrc.jar
    commons-logging-1.1.1.jar
    dropbox-java-sdk-1.3.1.jar
    dropbox-java-sdk-1.5.jar
    httpclient-4.0.3.jar
    httpcore-4.0.1.jar
    httpmime-4.0.3.jar
    jcommon-1.0.16.jar
    jfreechart-1.0.13.jar
    json_simple-1.1.jar
    junit-4.10.jar
    moneydance.jar
    natty-0.3.jar
    TableLayout-bin-jdk1.5-2007-04-21.jar

    Good luck!

    --Kevin

  5. 5 Posted by Timothy S.. on 09 Sep, 2013 04:54 PM

    Timothy S..'s Avatar

    Right. I was specifically referring to the detail that the "library" of "external JARs" that I configured in the Build Path, carried over into the execution environment, but it didn't carry over correctly. So it was necessary to add a list of "external JARs" again from C:\Program Files\Moneydance\jars\ to the execution classpath configuration also, and place them in the list ahead of the extension's build directory.

    Interestingly, I am getting this strange behavior where the majority of the extension's code is possible to trigger a breakpoint, but stepping through the code reveals that the displayed line of code does not match what is about to execute.

  6. System closed this discussion on 31 Mar, 2015 04:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac