Tech Blogging‎ > ‎

OpenBravo POS on Eclipse

posted Feb 26, 2012, 11:57 AM by Haris Hashim   [ updated Feb 26, 2012, 5:45 PM ]

Someone asked me about how to open up OpenBravo Pos in eclipse. Well either that or he is just pulling my leg for fun :D.


Let's put some background history first. A very dramatic story to the tune of "My cat ate my homework". The last time I was working with OpenBravo POS was when my wife asked me to deploy it to another shop. That shop was her sister shop but they both have their own separate product lines there.

The immediate challenge was to have a way to display sale earning base on this separate product lines. I thought that was not workable and would take a lot of coding time. Knowing my wife thought processes, I feel that my head will role down the hill after few weeks. So I silently did a compromise and actually define 2 business units in database. Make it a requirement for product to be registered to either of this 2 business unit.

Everything was peachy, the work is done in a week and deployment follows soon after. In fact, until today it is still running without a hitch (discounting the discount module that prints multiple line of discount and confuse the customer, but that is for another story!).

The Cat Ate My Homework

Now here is the sad part. Just about on the second week, my notebook crash. I remember that day as the day I wish to hear song on my notebook instead of my wife beutiful voice. Go to have lunch without turning off the media player. Come back to see that my notebook was not running and unable to turn it on again. Turns out it is not just the notebook crashed (software wise, not that I crash run the notebook to the floor or something), but also a dead hard disk that resist all the revival technique that I tried.

2 weeks is just the unlucky number here. More than two weeks means the source would have been in Mercurial repository located in external hard disk. 2 weeks means it is in a Mercurial repository still located in the notebook hard disk! What good is that?

Netbeans or Eclipse

Well, the code mentioned above is actually written using Netbeans. My personal reason being that it has good integration with Jasper Reports. That means even report creation and editing can be done within Netbeans. Easily done some more! Great tools if you have a team containing people with varying skill level. A hard core developer can easily use it to define/generate report as easily as the GUI design people.

In the 1 year plus after above incident, I believe that a lot might have change. Perhaps, nowadays Eclipse does have better support for Jasper Reports. By the way I love eclipse because it is fast. Using Jasper Report within Netbeans can sometime be described as riding a turtle to the end of the world. So be careful with zooming in guys. You might have to restart the whole IDE just to get out of it!

OpenBravo Pos in Eclipse

Anyway, here is my step to move the Netbeans code base to Eclipse. The guy who ask me actually try it and it works! But your mileage might vary. Your development machine might explode together with your database server. So please don't sue me.

1.  Open up your eclipse workspace folder
and create a new folder with the name of "OpenBravoPos" (actually any name will do, but consistently following instruction help minimize problem down the road).

2. You should have bellow folder from the OpenBravoPos check out. Copy them into the just created folder in step 1.

src-beans     src-erp     locales      reports      src-data      src-pos

3. Open up Eclipse. If workspace chosen in step 1 is not the default workspace, open or switch to the workspace.

4. Create a new project named as OpenBravoPos. Note that it is same name as the folder name created in step 1. The source that you copied earlier in step 2, should just show up in the new project.

At this point we already have the code in eclipse, but with lots of error. This is because library dependency requirement has not been specified yet.

5. Righ click on the project name, choose "configure build path" and then click on "Add External JARs". Browse to the "lib" folder and add all the jar libraries just inside the lib folder. Also add 1 jar file from Jasper Report sub folder named jasperreports-x.x.x.jar. Build the project if it is not set to auto build.

Adding this sets of jar files should result to a successful build. Other library in the "lib" folder might be required too!

6. In the second step, a "locales" folder is copied into the workspace. But OpenBravoPos still need to know the location of this folders. In Netbeans adding a class path to VM parameter does it. Somehow this does not works in Eclipse. Beats me! So the work around is to copy all the files inside that folder into the bin folder that got generated during build process.

In eclipse package explorer, click You can fin this file in src-pos with the following com.openbravo.pos.forms as the source path. With the file selected, click the run button and you should see the point of sale running!

OleBelle Pos


The screenshot shows a small amount of customization that I did. Some of them are trivial. Like replacing icon or image file in src_pos com.openbravo.pos.templates. Some of them are not so simple like the "MESSAGE OF THE DAY" shown above. Which require mucking around with the swing form code.

Customization of receipts printer output can be done inside the OpenBravoPos GUI itself. Just login as administrator, click Maintenance in Administration tab and look for Resources button. Clicking that button will show configuration view used to make the changes.

On the reporting side, customizing reports was done using Netbeans IDE and Jasper Reports plugin to edit or create new report. Initially there was a lot of OpenBravo logo that need to be removed. Simply because they are big and consume too much ink when printed.

Adding new report will require a different kind of customization. More so when a new form is needed. That will require coding of the swing form, then using BeanShell scripting (yes the POS GUI have scripting support!) to specify how to launch the form (putting a button somewhere in the GUI) as well as the glue for specifying which jasper report to use.

I did this to add labeling functionality right into the POS. Where the report can simply be printed on A4 sticker paper. Neat solution when you want to label product since the product name, price and barcode (yes OpenBravoPos support barcodes!) are already in the database.