I’m working on a closed source product called Ekwos. It’s a software to manage equestrian competition. The licensing model for this software require to be renew every year. For this reason, I wanted to add a basic licensing module to control who may use the software and for how long.
After some research, I found this article http://blog.afewguyscoding.com/2012/02/licensing-module-java/ providing what I want but I had trouble to adapt the source code for my how use. After couple hours, I refactored the original source code be more flexible and to meet my needs. The module is completely independent from any external module.
The code is release under MIT, BSD and Apache license.
Here is a snippet showing how to use it in your application. This snippet use SWT to display error message. Your application may use whatever you want instead of SWT.
You may get the full source code from this location. Jars are also provided.