tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/824-debugging-moneydance-extensions-in-eclipseInfinite Kind: Discussion 2015-03-31T16:17:04Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/286846222013-09-08T18:15:08Z2013-09-08T18:15:08Zdebugging Moneydance extensions in Eclipse<div><p>Hello Tim,</p>
<p>Yes, you can debug your extension and step through your code.
The key thing<br>
to do is to bind your debugger to the actual Moneydance.jar that
the<br>
application is using, instead of just the extension API jar.</p>
<p>I use IntelliJ IDEA. I added two Libraries to the project:<br>
1. "Moneydance Installed" = all the jars in C:\Program
Files\Moneydance\jars<br>
2. "Extension Dev" = extadmin.jar, not really needed to compile but
used in<br>
signing the .mxt</p>
<p>Then I setup the runtime settings for debugging like so:<br>
Main class: Moneydance<br>
VM options: {blank}<br>
Program arguments: {blank}<br>
Working directory: C:\Program Files\Moneydance\jars</p>
<p>I wrote the build script to automatically copy the newly built
and<br>
locally-signed jar to
${install}=C:\Users{user_name}.moneydance\fmodules</p>
<p>Then after compiling the first time and installing the .mxt in
Moneydance,<br>
subsequent runs could be made in the debugger. I pretty much build
all the<br>
time from the command line because you have to enter a password for
the key<br>
to sign the .mxt, and I've never figured out a good way to do that
in<br>
IntelliJ. After building on the command line, I just flip back to
IntelliJ<br>
and run, and now the code IntelliJ sees matches the code running in
the<br>
.mxt.</p>
<p>The sign and copy of the .mxt in the Ant script looks like
this:<br>
<br>
<br></p>
<p>Good luck!</p>
<p>--Kevin Author of the Find and Replace, HandyBank and Ratios
extensions, major<br>
contributor for the Quotes and Exchange Rates extension</p></div>mennesofttag:infinitekind.tenderapp.com,2009-01-14:Comment/286846222013-09-08T21:53:29Z2013-09-08T21:53:30Zdebugging Moneydance extensions in Eclipse<div><p>Thank you Kevin.</p>
<p>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.</p>
<p>After setting the working directory and removing
moneydance-dev.jar all together, I still get the same error. Here
are the details.</p>
<p>Moneydance prints:<br>
loaded helper: class
com.moneydance.apps.md.controller.platforms.DefaultHelper</p>
<p>I assume that it is not detecting that it needs to load:<br>
com.moneydance.apps.md.controller.platforms.WinHelper</p>
<p>The debugger immediately catches an exception and breakpoints on
the Moneydance class (no source) with the following details:<br>
Thread <a href=
"Suspended%20(exception%20NoSuchMethodError">main</a>)</p>
<p>Tim S.</p></div>Tim S.tag:infinitekind.tenderapp.com,2009-01-14:Comment/286846222013-09-08T22:18:00Z2013-09-08T22:18:02Zdebugging Moneydance extensions in Eclipse<div><p>I have the debugger triggering on breakpoints in the extension
source.</p>
<p>In: Run | Debug Configurations ... | Moneydance | Classpath</p>
<p>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.</p></div>Tim S.tag:infinitekind.tenderapp.com,2009-01-14:Comment/286846222013-09-09T12:03:32Z2013-09-09T12:03:32Zdebugging Moneydance extensions in Eclipse<div><p>Yes, for the record, <em>all</em> the jars need to be added from
the /jars folder<br>
so you don't run into NoSuchMethod exceptions. Here's the list as
of a<br>
recent build:</p>
<p>antlr-3.2.jar<br>
appsrc.jar<br>
commons-logging-1.1.1.jar<br>
dropbox-java-sdk-1.3.1.jar<br>
dropbox-java-sdk-1.5.jar<br>
httpclient-4.0.3.jar<br>
httpcore-4.0.1.jar<br>
httpmime-4.0.3.jar<br>
jcommon-1.0.16.jar<br>
jfreechart-1.0.13.jar<br>
json_simple-1.1.jar<br>
junit-4.10.jar<br>
moneydance.jar<br>
natty-0.3.jar<br>
TableLayout-bin-jdk1.5-2007-04-21.jar</p>
<p>Good luck!</p>
<p>--Kevin</p></div>mennesofttag:infinitekind.tenderapp.com,2009-01-14:Comment/286846222013-09-09T16:54:50Z2013-09-09T16:54:52Zdebugging Moneydance extensions in Eclipse<div><p>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.</p>
<p>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.</p></div>Timothy S..