CSV readin moneydance extension

percon's Avatar

percon

11 Sep, 2017 09:33 AM

I wanted to develop an extension for moneydance to read, process and import csv files according to my own needs. However I stuck at the point in using opencsv (or any other library) for java. I am able to compile the extension and there are no compiling error due to non found classes etc. (Added opencsv and its dependencies into pathelement of build.xml). When trying to run the extension always java.lang.NoClassDefFoundError: com/opencsv/CSVReader gets thrown. Is there some material out there how to include the things right?

  1. Support Staff 1 Posted by Sean Reilly on 11 Sep, 2017 09:38 AM

    Sean Reilly's Avatar

    Hello!

    Thanks for experimenting with this. It sounds like the ANT build file will need to add the jar file with the com.opencsv.* classes into the .mxt file when it is building. The .mxt file is basically just a jar file with all needed libraries with an additional data that is added in the signing process.

    Hope this helps!

    Sean Reilly
    Developer, The Infinite Kind
    http://infinitekind.com

  2. 2 Posted by percon on 11 Sep, 2017 09:48 AM

    percon's Avatar

    Thanks for the fast response. That sounds reasonable, I tried that by including the jar files in the jar target in the build.xml file by simply adding the path to the libaries:
    <fileset dir="../lib/" includes="*.jar"/>
    But maybe this is done wrong?

  3. 3 Posted by percon on 11 Sep, 2017 09:58 AM

    percon's Avatar

    Found the problem. As you said, the libraries were not correctly included into the jar build (.mtx) extension. By using:
    <zipgroupfileset dir="../lib/" includes="*.jar"/>
    and placing all .jar dependencies in lib folder everything works nicely!
    Thanks for the support!

  4. 4 Posted by Mike Bray on 11 Sep, 2017 12:57 PM

    Mike Bray's Avatar

    Hi Percon

    If you want an example of this type of Java extension have a look at https://bitbucket.org/mikerb/moneydance-2015/wiki/Extensions. you will find the Securitypriceload and loadsectrans. In the source folder you will find a build.xml which should build it correctly.
    In https://bitbucket.org/mikerb/moneydance-2015/wiki/Development you will find some general notes about developing extensions,
    Mike

  5. 5 Posted by -Kevin N. on 11 Sep, 2017 01:46 PM

    -Kevin N.'s Avatar

    Hi Mike,

    Have you seen Stan's work on the CSV Importer extension?
    https://github.com/stant/mdcsvimporter2015/releases

    -Kevin N.

  6. 6 Posted by percon on 11 Sep, 2017 05:20 PM

    percon's Avatar

    Thanks for the fast help. I managed to read in the csv.

  7. 7 Posted by Mike Bray on 12 Sep, 2017 08:07 AM

    Mike Bray's Avatar

    Hi Kevin

    It seems to be similar to mine, I guess we were both just plugging a gap
    in MD features. It looks like Stan and I developed our extensions at
    about the same time.

    Regards
    Mike

  8. Support Staff 8 Posted by Sean Reilly on 12 Sep, 2017 01:48 PM

    Sean Reilly's Avatar

    Also, it's not source code, but recent releases of MD have support for importing text files built-in, including auto-detection of field types and date formats with 2-pass importing. You can use that API here:
    http://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mode...

    Cheers,

    Sean Reilly
    Developer, The Infinite Kind
    http://infinitekind.com

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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