Extension Development in Eclipse

Quercus47's Avatar

Quercus47

18 Feb, 2022 01:56 AM

Hello All,

I'm working on an extension using java in the Eclipse IDE. I'm looking to run and debug the project directly from within Eclipse. I've read Mike Bray's very helpful wiki and followed the tips under debugging, but Eclipse is still having none of it.

Just as a test platform to get my feet wet, I'm using the myextension sample project distributed by IK, loaded up into the Eclipse IDE, then added all the moneydance jar files to the build path and created a debug profile. Still, many unrecognized modules and types. See image attached.

I've manually built the project using ant directly and that works just fine, but within eclipse, I can't get the file to run.

Is there more of a trick here I'm missing?

Assistance appreciated.

  1. 1 Posted by Stuart Beesley ... on 18 Feb, 2022 08:10 AM

    Stuart Beesley (Mr Toolbox)'s Avatar

    You seem to have basic Java modules undefined - e.g. javax.swing. I would start by creating a new Java project with defaults etc and check that basic Java links. Only then add in MD.

    I can’t help exactly, but for me using IntelliJ, with Jython, I had trouble initially getting Java linked and it took some playing with the settings to get the project settings, sources, and Java libraries set up properly.

    To set my Jython project up, I had to create a Project with Python 2.7 as the SDK (yours would be Java 15 or 17, add a moneydance.jar as a Library, add a Java Module called Moneydance (link the Library, and assign the SDK adopt-openjdk-15 (Hotspot) (or Java 17 azul/zulu).

    Lastly, whilst directed at Jython, some of this may be of interest:
    https://yogi1967.github.io/MoneydancePythonScripts/
    https://raw.githubusercontent.com/yogi1967/MoneydancePythonScripts/...

    Sorry not of more help.

  2. 2 Posted by Mike Bray (Quot... on 18 Feb, 2022 09:26 AM

    Mike Bray (Quote Loader Author)'s Avatar

    Hi, as Stuart has pointed out your build path seems to be lacking the basic jars. As suggested create a Java project from Eclipse. Copy your source files to the newly created source directory. Do this from with in Eclipse so it creates the packages correctly. You will get a file structure like this:

    src
    --com

    ----moneydance

    -----modules

    -------features

    ---------extensionname

    -------------source files

    Right click on your new project, select 'properties', select 'Java Build Path/Libraries'

    Make sure there is a JRE System Library listed, if not add a Library

    You need to add the Moneydance jars.

    Add External Jars under Classpath, do this by selecting the jars from your Moneydance installation, they are in the directory lib.

    By doing this your project should build within Eclipse. You will still need to build your extension outside of Eclipse using ant and the build file.

    Once built, run Moneydance outside of Eclipse andd add your extension to it.

    In Eclipse select Run/run Configurations.
    Create a new entry selecting your new project as the Project, enter 'Moneydance' as the class.
    Save
    Click on Run and select your project. This should run Moneydance from within Eclipse. Once this works you can then set breakpoints within your extension and run it using Debug.

    Hope this helps, let me know if you run into issues. Please provide as much information as you can. At least I will need to know the OS you are using, version of Eclipse, version of Moneydance and screen shots of the errors you are encountering.
    Regards
    Mike

  3. 3 Posted by Quercus47 on 19 Feb, 2022 02:12 AM

    Quercus47's Avatar

    Stuart & Mike,

    Thank you for getting me pointed in the right direction. The issue was two-fold. First, when I installed Eclipse, I only had the "regular" consumer version of Java installed, 1.8. I then replaced that with Java 17, and I thought I'd told Eclipse where the new source files were, but something wasn't right. I eventually completely removed eclipse, all the workspace directories and started again. To solve the moneydance references, I had originally entered the moneydance under Modulepath. Once I changed that and placed them in Classpath, that pretty much fixed things.

    A couple of last items, under Run Configurations, I had to select "Include system libraries when searching for a main class", otherwise, it would not run 'cus it couldn't find a main class.

    I'm going to summarize all of this in a new post as a reference for others.

    Thanks again.

  4. System closed this discussion on 21 May, 2022 02:20 AM.

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