Trouble debugging extension - "MacHelper2: loaded platform helper"
I have been updating the yahooqt updater in moneydance_open.
I've added a service to pull quotes from TD Ameritrade. TDAmeritrade's allowed request rate is 120 requests per minute. For most of us, that means I can send a burst of requests for all our stocks and get results back in a second or two.
It works great when tested in the iDE but I can't get moneydance to run from the IDE in order to debug the integration. When I try to run it as I used to I get
MacHelper2: loaded platform helper
And it quits.
I'm using Intellij as an IDE. Any help would be greatly appreciated. I think I can get 1 or 2 more services added in if I can get this working right.
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
Support Staff 1 Posted by Sean Reilly on 04 Mar, 2020 11:29 AM
I'm so glad to hear you're working on it! I run moneydance from the IDE (also intellij) after building and installing the extension separately from the command-line. Do you launch MD using the -d flag? If so, that should write any error messages and stack traces to stderr where it can be caught and displayed by intellij.
Also, I'm close to having support for FT.com connections integrated (provided by Mike Bray).
Thanks,
Sean
--
Sean Reilly
Developer, The Infinite Kind
https://infinitekind.com
2 Posted by R. Schmid on 05 Mar, 2020 03:58 AM
I tried the -d option and found this;
Exception in thread "main" java.lang.NoClassDefFoundError: com/dropbox/core/DbxException
at com.moneydance.apps.md.controller.sync.SyncManager.<init>(SyncManager.java:38)
at com.moneydance.apps.md.view.gui.MoneydanceGUI.<init>(MoneydanceGUI.java:127)
...
the version of dropbox-core-sdk included in Moneydance is 3.0.11
Normally I would assume that this is the wrong version of dropbox but if it is, I don't see how MoneyDance could run with it.
Support Staff 3 Posted by Sean Reilly on 05 Mar, 2020 06:40 AM
Which Dropbox jar file is in your runtime classpath? You'll need all the same jars from the Moneydance installation.
Thanks,
Sean
4 Posted by R. Schmid on 05 Mar, 2020 02:49 PM
I purged my drive of all possible competitors. I added all the jars from my current install of Moneydance at /Applications/Moneydance/Contents/Java
I did find a suspicious file from 2015 at ~/Library/Containers/com.infinitekind.MoneydanceOSX/Data/Library/Application Support/Moneydance/tmp/pythonTemp/cachedir/packages/dropbox-java-sdk-1.5.pkc which I deleted (after backing up, of course.)
Here is the entire logs from my attempt to run from inside the IDE;
/Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -jar /Applications/Moneydance.app/Contents/Java/moneydance.jar -d
debugging...
MacHelper2: loaded platform helper
Error reading preferences: java.io.FileNotFoundException: /Users/myuser/Library/Application Support/Moneydance/config.dict (No such file or directory)
java.io.FileNotFoundException: /Users/myuser/Library/Application Support/Moneydance/config.dict (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at com.infinitekind.util.StreamTable.readFromFile(StreamTable.java:106)
at com.moneydance.apps.md.controller.UserPreferences.readSettings(UserPreferences.java:619)
at com.moneydance.apps.md.controller.UserPreferences.<init>(UserPreferences.java:386)
at com.moneydance.apps.md.controller.UserPreferences.getInstance(UserPreferences.java:406)
at com.moneydance.apps.md.controller.Main.initializeApp(Main.java:331)
at com.moneydance.apps.md.controller.Main.initializeApp(Main.java:304)
at com.moneydance.apps.md.controller.Main.main(Main.java:222)
at Moneydance.main(Moneydance.java:7)
loaded platform-specific helper
Starting Moneydance 2019.4 (1894) at Thu Mar 05 08:47:52 CST 2020
Settings Folder: /Users/myuser/Library/Application Support/Moneydance
OS: Mac OS X 10.15.3 x86_64
Java: 11.0.3 (Oracle Corporation)
Is in sandbox: false; restricted file access: false
loaded all modules
Initializing fonts:
preferred: [[Helvetica Neue, Helvetica, Dialog]]
regular: [[Helvetica Regular, Arial, SansSerif, Dialog]]
mono: [[Gill Sans, Monospaced]]
fonts resolved:
default: Helvetica Neue:13.0:style0
mono: Gill Sans:13.0:style0
header: Helvetica Neue:15.0:style0
register: Helvetica Neue:12.0:style0
reportTitle: Helvetica Regular:32.0:style0
calendarTitle: Helvetica Neue:12.0:style0
reportHeader: Helvetica Neue:11.0:style0
detailTitle: Helvetica Neue:15.0:style0
Exception in thread "main" java.lang.NoClassDefFoundError: com/dropbox/core/DbxException
at com.moneydance.apps.md.controller.sync.SyncManager.<init>(SyncManager.java:38)
at com.moneydance.apps.md.view.gui.MoneydanceGUI.<init>(MoneydanceGUI.java:127)
at com.moneydance.apps.md.controller.Main.getUI(Main.java:926)
at com.moneydance.apps.md.controller.Main.startApplication(Main.java:793)
at com.moneydance.apps.md.controller.Main.main(Main.java:223)
at Moneydance.main(Moneydance.java:7)
Caused by: java.lang.ClassNotFoundException: com.dropbox.core.DbxException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more
Process finished with exit code 1
5 Posted by R. Schmid on 06 Mar, 2020 03:26 AM
Let me approach this differently. If I want to run Moneydance from the command line, I can type `open Moneydance` and OS X does some kind of magic.
If I try to run
java -jar /Applications/Moneydance.app/Contents/Java/moneydance.jar -d
or some variant I get the above stacktrace.
Is there more I need to feed into java before I open Moneydance?
6 Posted by hleofxquotes on 06 Mar, 2020 06:20 PM
File moneydance.jar does not include all the 3rd-party jar files (dependencies). You will need to arrange for the "launcher" to include those 3rd-party jar files in the classpath. How to do that is highly dependent on the "launcher".
For example, for command-line, roughly, you will need to do something like this
java -cp moneydance.jar:flie1.jar:file2.jar ... moneyDanceMainClass -d
7 Posted by R. Schmid on 07 Mar, 2020 12:28 AM
Thank you "hleofxquotes" that was the kick in the head I needed. I've been away from pure java dev for too long and my first thought was "I've already defined classpath..."
But then I realized, If I was getting the EXACT same result in my IDE as I was on the commandline, my IDE was NOT treating my classpath the way I thought it was. So, back to java fundamentals.
I will post my solution here so no one else goes through the same thing.
First, you can NOT use -classpath/cp at the same time as you use -jar. Second, the moneydance.jar does NOT include it's support libraries in the manifest or jar so you can't use -jar AT ALL.
On MacOS what I had to use was;
java -cp '/Applications/Moneydance.app/Contents/Java/moneydance.jar:/Applications/Moneydance.app/Contents/Java/*' Moneydance
Note the single quotes. They are necessary on OS X. (Or maybe that's just the csh which I favor. In either case I'm leaving it here for reference.)
So that means, in Intellij when I create a run configuration I can NOT set it up to be a 'Jar Application'.
Instead, create a configuration based on the 'Application' template.
Main Class: Moneydance
Working Directory: Path to moneydance_open
Use classpath of module: moneydance_open
JRE: 11
MODULE SETTINGS:
Under Project Settings -> Libraries II created 3 libraries.
moneydance -> only the moneydance.jar,
moneydance_support -> all the other jars in the app
moneydance_dev -> the two support libs
Finally, under Project Settings -> Modules -> moneydance_open I fixed the order of those libraries
11 (java version "11.0.3")
moneydance
<Module Sources>
moneydance_support
moneydance_dev
And then you can run Moneydance from the IDE
8 Posted by R. Schmid on 07 Mar, 2020 05:25 AM
OK, the Pull Request is waiting. Getting an API key from TDAmeritrade is not as straight forward as Alphavantage but it's worth it.
System closed this discussion on 06 Jun, 2020 05:30 AM.