Outdoors, Green Living, Homesteading, Sustainable living, Green Building

Java Ledger a simple free accounting program that I wrote

WANTED! Comments. Not wanted! Compliments. If you want your comment to be accepted first you must not be a spammer that WordPress recognizes and second you need to comment specifically on some of the article’s specific material or facts.

The Survival Pod Cast
Off Grid Net

*** Version II Is now available. So this post is out of date.. you an find the version
this post talks about in files ver1 folder on sourceforge page.

Need a simple free accounting program? I wrote one using the Java Programming Language. It is at Java Ledger at Source Forge This project uses two other projects. JCurses is at JCurses at Sourceforge and JDOM JDOM.org  And you may want to read my post on Java In Ten Minutes This will help you to install Java so that you may run this app. And as a prerequisite for the accounting read my post Home Accounting

JDOM is for reading the journal.xml and accounts.xml files. JCurses is for displaying colored text in the dos console. I downloaded both of these and put one under c:\dev\jdom and one under c:\dev\jcurses

Next I set the classpath with

set classpath=;.;c:\dev\jdom\*;c:\dev\jcurses\lib\*;

Next download and unzip the accounts.zip file. The install.zip file download contains the zip files for JDOM and JCurses. This is actually an Eclipse workspace. If you unzipped it under c:\dev then it will be in c:\dev\workspacejcurses and then

Here you will notice accounts.xml and journal.xml as example data files. You may edit these with dos edit command or notepad or vi on linux or jedit any other favorite text editor. Below are some samples from the files.

Sample Journal.xml

  <year value="2013">
    <month value="jan">
        <day value="1" />
        <credit account="400" note="Onhand wallet" />
        <debit account="100" note="cash onhand" />
        <amount value="78.64" />
        <day value="1" />
        <credit account="400" note="Onhand bank1" />
        <debit account="100" note="checking onhand" />
        <amount value="350.71" />
        <day value="1" />
        <credit account="400" note="onhand bank2" />
        <debit account="100" note="checking onhand" />
        <amount value="40.58" />
        <day value="1" />
        <credit account="100" note="Denny's 2 meals" />
        <debit account="501" note="2 meals + tip" />
        <amount value="26.50" />
        <day value="2" />
        <credit account="100" note="Flying J" />
        <debit account="501" note="Food, coke, water" />
        <amount value="4.65" />
        <day value="2" />
        <credit account="100" note="Van Insurance" />
        <debit account="507" note="Van" />
        <amount value="66.64" />
        <day value="2" />
        <credit account="100" note="Vending Candy" />
        <debit account="501" note="Candy Bar" />
        <amount value="1.00" />
        <day value="2" />
        <credit account="100" note="Flying J Pizza/Chicken" />
        <debit account="501" note="Pizza/Chicken" />
        <amount value="10.58" />
        <day value="3" />
        <credit account="400" note="WSE Deposit" />
        <debit account="100" note="WSE Pay" />
        <amount value="371.92" />

And Sample Accounts.xml

  <type name="asset">
    <account number="100" name="Cash"/>
    <account number="101" name="camper"/>
    <account number="102" name="boat"/>
    <account number="103" name="van"/>
    <account number="104" name="home"/>
    <account number="105" name="Camping"/>
    <account number="106" name="Hunting"/>
    <account number="107" name="Fishing"/>
    <account number="108" name="Gardening"/>
    <account number="109" name="Homestead"/>
  <type name="liability">
    <account number="200" name="CreditCards"/>
    <account number="201" name="CreditUnion"/>
    <account number="202" name="Ford Motor"/>
    <account number="203" name="Family"/>
  <type name="capital">
    <account number="300" name="Larry's Capital"/>
  <type name="income">
    <account number="400" name="Income"/>
  <type name="expense">
    <account number="500" name="Work Misc Expenses"/>
    <account number="501" name="Work Food"/>
    <account number="503" name="Work Phone/Internet"/>
    <account number="504" name="Work Entertainment"/>
    <account number="505" name="Home"/>
    <account number="506" name="Home Food"/>
    <account number="507" name="Insurance"/>
    <account number="508" name="Medical"/>
    <account number="509" name="Utility Gas/Electric"/>
    <account number="510" name="Rent"/>
    <account number="511" name="Vehicle"/>
    <account number="512" name="Satalite/Internet"/>
    <account number="513" name="Misc Internet"/>
    <account number="514" name="Taxes"/>
    <account number="515" name="Ministry Support"/>
    <account number="516" name="Camping"/>
    <account number="517" name="Hunting"/>
    <account number="518" name="Fishing"/>
    <account number="519" name="Gardening"/>
    <account number="520" name="Homesteading"/>
    <account number="521" name="Misc"/>
    <account number="522" name="Banking"/>
    <account number="523" name="Gifts"/>

Next cd bin to get to the bin folder. In here you will see some .class files.
Ledger.class is the main class. In this file you will see a comment which I
will give you below.

* This main method is the interface for this app. At least for now. Later
* I may make a GUI interface using Swing.
* example command line commands are
* 'java journal month nov2012' prints the journal for November 2012
* 'java accounts type asset'  prints the list of asset accounts
* 'java accounts type expense' prints the list of expense accounts
* 'java ledger month nov2012 100' prints the ledger records for cash account
* 'java ledger month nov2012 501' prints the ledger records for work food expenses
* 'java balance month nov2012 asset' prints the balance for the asset accounts
* 'java balance month nov2012 income' prints the balance for the income accounts
* 'java balance month nov2012 bal' prints the balance sheet
* @param args
public static void main(String args[]) {

Note that shows month nov2012 which is some bogus sample data I made up. I have real
data from my own life in jan2013 and will continue it for the rest of the year. You will get
to see how stupid I am with my money. Or how smart I am hopefully.

Next I will run some commands on Jan 2013 which covers data from 1/1/2013 to 1/22/2013.  22 Days.  I will grab some screen shots and show you the command and output below

c:\dev\workspacejcurses\accounting\bin>java Ledger accounts type expense

c:\dev\workspacejcurses\accounting\bin>java Ledger balance month jan2013 bal

c:\dev\workspacejcurses\accounting\bin>java Ledger balance month jan2013 asset

c:\dev\workspacejcurses\accounting\bin>java Ledger balance month jan2013 expense

c:\dev\workspacejcurses\accounting\bin>java Ledger ledger month jan2013 100

c:\dev\workspacejcurses\accounting\bin>java Ledger ledger month jan2013 501

c:\dev\workspacejcurses\accounting\bin>java Ledger ledger month jan2013 400

c:\dev\workspacejcurses\accounting\bin>java Ledger journal month jan2013

So you can see that this application does actually work. It still need some work however. I will be updating it over time. The latest source will be in the SVN code repository on the sourceforge site. This source will now make a good base for a Windows Desktop app or a Web Page App, maybe even a Phone app.

*** Version II Is now available. So this post is out of date.. you an find the version
this post talks about in files ver1 folder.


3 responses

  1. Pingback: Home Accounting (Doing the Bills) « Larry D Gray

  2. Pingback: Java Accounting Ledger V2 | Larry D Gray

  3. Pingback: Cost of Prepping, Food for Thought :: Brink of Freedom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.