Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent a Demo Java Program from my client's regular use?

I have made a demo small program that I want to deliver to my client so that he can run it for 5 times to check its functionality. It is not a big software for which I implement some serial-key functionality and make a trial software.

I want a simple solution which can restrict the use of the program more than 5 times or which can delete itself after its threshold limit.

One solution came in my mind. I make 4 .txt files through the same program and store them at diff. locations on the client computer and these files will store the number of times the program has been run. Each time the application starts, it checks all those files and if any file contain the number representing the threshold limit, it simply exit by saying that the threshold limit has been reached.

Is there any other more better solution, yet simple, to restrict the client from using it various times?

It would be even more better if the program gets deleted after its threshold limit.

like image 838
Yatendra Avatar asked Jan 27 '10 11:01

Yatendra


2 Answers

If you want it make really simpler, put a time check and don't allow client to run the code when the time has expired after say five days or one week from today

You can try below snippet

Calendar expiry = Calendar.getInstance();
expiry.set(2010, 1, 31,0,0); // Expire at 31 Jan 2010
Calendar now = Calendar.getInstance();
// If you don't trust client's clock, fetch time from some reliable time server
if( now.after(expiry)){
// Exit with proper expiry message
}
else
{ 
// let the customer enjoy your software
} 

You can check here on how to fetch time from a trusted time server.

like image 109
Ravi Gupta Avatar answered Sep 25 '22 15:09

Ravi Gupta


Consider using Java Web Start to deploy your software with a JNLP file per customer with a customer specific, hard to guess, location. This allows you to do centralized management, and delete the JNLP when the time period is up.

Also ensure that a small jar is always uncached so the customer need to contact your server to be able to run.

like image 27
Thorbjørn Ravn Andersen Avatar answered Sep 23 '22 15:09

Thorbjørn Ravn Andersen