Double-entry accounting libraries for Java?

Derek Mahar picture Derek Mahar · Sep 2, 2010 · Viewed 12.8k times · Source

What double-entry accounting libraries are available for Java?

Answer

CodeSlinger picture CodeSlinger · May 14, 2011

I did write a library for myself, but since it was for a really trivial application, I don't know if it would suit a general purpose accounting need.

It has an interface like:

    ledger.newPosting(new Date(), "Received $10 from Anne")
            .debit("Cash:Anne", 1000)
            .credit("Dues Received", 1000)
            .post();

    int cashBalance = ledger.getAccount("Cash").getTrialBalance();
    assertEquals(-1000, cashBalance);

    int anneBalance = ledger.getAccount("Cash:Anne").getTrialBalance();
    assertEquals(-1000, anneBalance);

    int duesBalance = ledger.getAccount("Dues Received").getTrialBalance();
    assertEquals(1000, duesBalance);

Is this the kind of thing you're looking for? Anyone else actually INTERESTED in this code? I wrote it generically, but never published it because I didn't think anyone would want something this trivial.