Getting Started with Eclipse

Quercus47's Avatar

Quercus47

24 Feb, 2022 01:54 PM

This post is a walk-through for installing and configuring Eclipse on a Windows machine intended to assist others who may be interested in getting started with Moneydance extensions. I invite others to add their tips and experience using other platforms (mac, etc.) below. If you have problems/issues or need assistance, please DO NOT post those below but put those in another thread.

This summary is based on my experience getting started using Eclipse and a few pointers to help in areas where I encountered trouble along the way. It is not a primer on extension development, others have covered that better elsewhere. I've included some links to other useful resources below.

Introduction & Acknowledgements
Just for background, I have some experience in coding, but this is my first dive into java, so I'm learning along the way. Most of my experience has been in Office development (VBA) or Maker based (Arduino/C++ and Pi/Python).

I would like to thank Stuart Beesley and Mike Bray for their assistance. Both have their own Wikis that provide lots of useful information, links provided below.

Resources
If you have not already done so, start off by reading InfiniteKind's developer page, download the Developer's Kit, read the included Readme file and study the sample extension and related XML files.
https://infinitekind.com/developer

Other useful links (be sure to read - both contain their own pages on how to develop MD extensions that are much more detailed than what I've provided here!)
Mike Bray:
https://bitbucket.org/mikerb/moneydance-2019/wiki/Home
https://bitbucket.org/mikerb/moneydance-2019/wiki/Extensions
https://bitbucket.org/mikerb/moneydance-2019/wiki/Development
https://bitbucket.org/mikerb/moneydance-2019/wiki/Application%20Events

Stuart Beesley:
https://yogi1967.github.io/MoneydancePythonScripts/
https://raw.githubusercontent.com/yogi1967/MoneydancePythonScripts/...

Downloads:
Java: https://www.oracle.com/java/technologies/downloads/
Apache Ant: https://ant.apache.org/bindownload.cgi
Eclipse: https://www.eclipse.org/downloads/

Documentation:
Moneydance API: https://infinitekind.com/dev/apidoc/index.html
Java: https://docs.oracle.com/javase/7/docs/api/
Java Dialogs: https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
Ant: https://ant.apache.org/manual/index.html

Getting Started with Eclipse
1) Start by making sure you have the most recent Java installed. Note - you need the most current full Java SDK (as of this writing, version 17). This is NOT the same Java you get if you simply Google "Download Java". That is a 'consumer' version and is an older and more limited distribution and will not support your needs.
2) Download and install Apache ANT. Also be sure to follow the setup tasks listed (see documentation link above on the Installing Ant page). You will need to manually adjust some of your system settings for Ant to run properly.
3) Download and install Eclipse for Java Developers, be sure that Eclipse is referencing the full java SDK during installation.
4) At this point, write a short Java program that uses a couple of java libraries, just to make sure that Eclipse is working properly and sees the java libraries.

At this point, I recommend that you use Ant to build your key files, as well as to compile and install the myextension sample extension provided by IK in their Developer's Kit. Before proceeding with Eclipse, you should get familiar with the basics of MD extensions, the needed folder structure, and the various files required to build and compile an extension. Install the extension in MD and make sure it runs properly. Once you confirm it runs - REMOVE the myextension sample from Moneydance before continuing.

I also recommend, if you haven't already, read Mike Bray's posts here before you continue:
https://bitbucket.org/mikerb/moneydance-2019/wiki/Development

The next step is to configure Eclipse.
5) Within Eclipse, create a new Workspace where you will develop your extensions, as well as a new Project named "Moneydance".
6) Open Properties for the project Moneydance and select Java Build Path. Select Libraries tab.
7) Make sure that "JRE System Library [JavaSE-17]" (or its updated equivalent) is listed under Modulepath.
8) Click Classpath. Then use the "Add External JARs…" button to reference all the Moneydance *.jar files (on my computer, these were contained under c:\Program Files\Moneydance\lib).
9) Under the Moneydance project, create a new Package called "com.moneydance.modules.features.myextension" (note that Eclipse will create the needed directory structure on the disk based on the package name).
10) When creating the new package DO NOT select the "Create package-info.java" option
11) Add two classes to the package identical to the two classes included in IK's myextension sample (create a class of the same name, delete the auto-generated code, then copy/paste the code from IK's sample).
12) At this point, if all has gone according to plan, Eclipse should now have IK's myextension sample loaded and there shouldn't be any compile errors. If Eclipse is saying it can't resolve any types or that an import is missing, something went wrong in the above steps. Please double check your steps.
13) Find the folder structure on your disk that was created by Eclipse. Copy the following files into the src directory: build.xml, priv_key, pub_key.
14) Below, the src folder, find the myextension folder and copy over the icon.gif and meta_info.dict files provided by IK.
15) Exit out of Eclipse, and use ANT to compile myextension again from its new location. Return to Monedance and install myextension.mxt from the new location and run it to make sure it works.
16) Exit out of Moneydance.
17) Return to Eclipse and open your Moneydance project. Then click Run menu and then Run Configurations.
18) In the pane on the left, right-click Java Application and then New Configuration
19) Check that Moneydance is listed under Project. If not, use the Browse… button to locate and select it.
20) Under Main class, click the Search… button. If all is going well, you should see an entry in the list called "Moneydance - (default package)". Select that and click OK
21) Check the box "Include system libraries when searching for a main class", then Apply
22) Click Run. This should then launch Moneydance from within Eclipse and the myextension sample (installed above) should work. Note the name that appears in the top of the window which should be "Account List"
23) Close the extension and close Moneydance
24) Within Eclipse, open the file Main.java and find the method public String getName(). Change the return value from "Account List" to "My New Title" or anything else you like. Click save and then Run.
25) This time when you select the myextension sample, you should see your new text at the top of the window.

You are now ready to create your own extensions. You can continue to add more packages (one for each extension) under the Moneydance project, each using a name such as "com.moneydance.modules.features.mynextextension". All the configurations above should work for the new extensions, except that you'll need to edit the build.xml file for whatever extension you're compiling with Ant. You will also need to build and install the extension using Ant and the resulting mxt file before you will be able to run them from within Eclipse.

I hope this has helped. Good luck.

  1. System closed this discussion on 26 May, 2022 02:00 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