-
Notifications
You must be signed in to change notification settings - Fork 0
Development Environment
Home>Moneydance>Development>Development Environment
You will need a Java Development Kit. Moneydance 2015 comes with the Java 1.8 runtime and Moneydance 2019 comes with Java 11. TIK updates the version of Java being used with each build, for example build 5064 (Moneydance 2023) comes with the Eclipse Adoptium version 21. If you are developing extensions make sure you match your environment with the version of Moneydance and Java you are using.
Note: You can not use the JRE provided with Moneydance, you need to install the equivalent JDK.
You will need something to run your build file such as ANT.
Any IDE will work, though one built for Java will help, for example Eclipse or JetBrains IDEA.
Extensions are held in a Java zip file with an file extension of .mxt. Basically this is a .jar file with the addition of a signature file. This file is used by Moneydance to verify that an extension has been validated by InfiniteKind. The .mxt file is created along with the signature file by running the Keyadmin application. The provided build.xml has the code to do this:
#!Xml
<java newenvironment="true"
classpathref="classpath"
classname="com.moneydance.admin.KeyAdmin">
<arg value="signextjar"/>
<arg value="${privkeyfile}"/>
<arg value="${privkeyid}"/>
<arg value="loadsectrans"/>
<arg line="${dist}/loadsectrans.mxt"/>
</java>
Before you can compile your code you need to create the keys to be used by Keyadmin. You do this by running the build file with the target genkeys, i.e
#!cmd
ant genkeys
It will ask for a pass phrase and then generate the keys.
Every time you compile your extension you will need to enter the pass phrase. This has the disadvantage that you can not use Eclipse to compile the code. You will need to run this from a command line interface.
- Set up a short cut from your desktop that starts a Command Line on the src directory for your extensions
- run
#!cmd
ant extensionname
This will do a normal build of the java code and then run the Keyadmin app to add the signature file. It will ask you for the pass phrase.
The directory structure for extensions is:
#!cmd
Moneydance
-- src
----priv_key (generated)
----pub_key (generated)
----com
------moneydance
--------modules
----------features
------------extensionname
--------------java files (*.java)
----build
------moneydance
--------modules
----------features
------------extensionname
---------------classfiles (*.class)
--lib
----extadmin.jar
----moneydance-dev.jar
--dist
----extensionname.mxt
--bin
----com
------moneydance
--------modules
----------features
------------extensionname
--------------class files (*.class)
The package name of extensions is com.moneydance.modules.features.extensionname
The supplied build file uses the above structure and places the extension .mxt file in the dist directory.
You will need to change the file to include a target for your extension. It is supplied with the name 'myextension'. Change all instances of 'myextension' to the name of your extension. This name must match the directory name for the source which in turn must match the package name in your source files.
If you want the build file to move the created .mxt file directly to the Moneydance fmodules directory you can amend the build file.
Add the following to the top of the build file after the "optimize" line:
#!xml
<property name="install" value="C:\Users\Mike\.moneydance\fmodules"/>
Where the value points at your installation of Moneydance.
At the bottom of pair for your extension place the following just before the :
#!xml
<delete file="${dist}/extensionname.mxt" verbose="true" failonerror="false" />
<move file="./s-extensionname.mxt" tofile="${dist}/extensionname.mxt" verbose="true" failonerror="false" />
<copy file="${dist}/extensionname.mxt" tofile="${install}/extensionname.mxt"
Remember to change 'extensionname' to the name of your extension.
Using Eclipse you have a number of features available to you.
- Eclipse will compile as you go flagging errors and warnings. This can aid you creating clean code
- You can debug your extension at the source code level (see Debugging)
- You can interface it with GIT and bitbucket to provide version control
For Moneydance extensions you need to compile with ANT so the signature is added to the .mxt file. Even though Eclipse will compile as you go it does not add the signature and thus Moneydance will complain when it tries to load a unsigned .mxt file. Just before you are ready to test run the ANT build file.
The IDEA development environment has the same features as Eclipse plus a good interface to ANT. Add the ANT plugin to your environment (use File/Settings/Plugins) and then add your build.xml to the plugin.
You can use the same directory structure as Eclipse though IDEA will use a different directory for the compiled classes for its internal compiling.
Once you have created your project you will need to update the Project Structure (File/Project Structure).
-
Select Project and select the SDK to match the one supplied with Moneydance.
-
Set the language to SDK Default
-
Select Libraries and make 2 entries:
a. Create a library that points to the .jars required by your extension that are not supplied by Moneydance or the JDK
b. Create a library that points at the lib directory of the installation of Moneydance (e.g. c:\Program Files\Moneydance\lib)
-
Select Modules and add a 'Sources' entry that points at the source directory
-
There should be an entry under Dependencies for each library. Make sure they are selected
You should be able to Build your project.
Using the extadmin.jar file to sign your extension means you will have to enter the pass phrase each time. To automate this you can use the Signmxt.jar found at Download Directory. Download this jar and place it in your classpath. Change your build.xml file from:
#!xml
<java newenvironment="true"
classpathref="classpath"
classname="com.moneydance.admin.KeyAdmin">
<arg value="signextjar"/>
<arg value="${privkeyfile}"/>
<arg value="${privkeyid}"/>
<arg value="myextension"/>
<arg line="${dist}/myextension.mxt"/>
</java>
to:
#!xml
<java newenvironment="true"
classpathref="classpath"
classname="SignMxt" fork="yes">
<arg value="signextjar"/>
<arg value="${privkeyfile}"/>
<arg value="${privkeyid}"/>
<arg value="myextension"/>
<arg line="${dist}/myextension.mxt"/>
</java>
Create a file called sign_pw.txt with your pass phrase in it and place it in your source directory.
When IDEA runs the ant build it will automatically sign your extension.