[GNC] Java APIs for gnucash

NH Rao nhrdls at gmail.com
Mon May 18 16:35:10 EDT 2026


Greetings,

https://github.com/nhrdl/java-gnucash

This started with my own need, it has been tested on only one real life
GNUcash datafile - mine, so if you choose to use it, please be careful and
make sure you have adequate backups.
For my use cases it seems to work the way I want it to work. If you are
comfortable with Java and want to play around, please feel free.

I am especially looking for experience on other operating systems and other
forms of gnucash data such as databases etc. Technically it should work as
it's just a URI, but practically it might not behave. It has been only
tested on a platform available to me - Ubuntu 24.04 and gnucash version 5.5

This library is Java binding for gnucash API. While there are multiple Java
libraries available, as far as I know, none of the libraries use the API
exposed by gnucash. This library uses the same technique sample python
scripts included with gnucash use - load the shared library and call
functions from the library.

So far, I am able to achieve most of what python utilities do, may not be
exactly the same approach, but functionality is there.

I'd some specific needs, some related to reports, some related to data
input. For the reports, I've invested in the same mutual fund in multiple
accounts. It was getting harder for me to keep track of total investment
because of my account structure. There is a utility that outputs the
information for a given commodity as gnucash calls it, from all the
accounts.

For input, I wanted to read my paystub PDF file and create entries
automatically. This includes gross/net pay, taxes and deductions splits.
Similar story for my mortgage. Read the PDF statement and create splits
automatically based on information coming from the PDF.

Lastly, updating the stock/fund prices. I found an API from Twelve data and
used it to update the prices. I've no relationship with Twelve data apart
from creating the API key and using the free version of API. Twelve data
throttles the calls, so code will notice the throttling and wait until
throttling timeout is done.

While sample utilities are working, it's very hard to illustrate with
examples as this is real life confidential data. For PDF files, generally
speaking there are two parts, a part which reads data from PDF and another
part that actually creates the transaction and splits. For splits, code
uses a simple mapping file that maps relevant entries from PDF to account
GUID. These mapping files are available in code.

Hope you also enjoy,

Niranjan


More information about the gnucash-user mailing list