Application expiry strategy

I have developed an application in java swing.. I am going to give it to my client for trial. I want that the software to stop its working after a specified period.. how can i do this??
Who is Participating?
Dejan PažinConnect With a Mentor Head of SW DevelopmentCommented:

There are many ways to do this, depends on secure you would like to make it.

Here are some examples:

1. Check the system date and compare it to a hardcoded date. Obviously, the client can change the system date on his local machine, and pass by this date check. But this is the simplest solution.

2. Create a webservice and have the application call the service with a unique key, and the webservice then checks if the key is still valid.
AuriiAuthor Commented:
I have used the 1st solution earlier..
My client wont be using internet hence i cant use the 2nd solution also..
Is there any other solution apart from these?
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

zzynxSoftware engineerCommented:
You could use an encrypted "license file" that contains an expire date. (This way you don't have to recompile your program for each different expire date you want)
At start up your program reads in that file, decrypts it and determines the expire date.
Of course, setting back the clock does always work to bypass these ways of working.

At installation time you could write an encrypted expire date (today + x days) in the registry (in a well hidden place).
Dejan PažinHead of SW DevelopmentCommented:
>> I have used the 1st solution earlier..

Why wont you use this solution any more?
aciuicaConnect With a Mentor Commented:
I think that this first solution can be improved if you store at startup the system date and every time compare compare the system date with last stored date. If the system date is smaller than last stored system date you know that the user changed back the date and you can make the application expired.
AuriiAuthor Commented:
But user can log in many times in single day. If today is 2/3/2011 then we can store this date but on next day "before log in" user can set same date 2/3/2011. By this way if he set same date on each day before login then we can not make the application expired.
for_yanConnect With a Mentor Commented:
But if along with checking that the date should not be later than certain pre-assigned date,
you will also  encode the date and store the date at each startup and
then check on the next startup that the date + time should be later than on previous startup
and then do not go forward if (1) the current date is before the stored date or (2) later than pre-assigened date - then
eventually this date chasing will become very annoying for any user.
aciuicaConnect With a Mentor Commented:
Let say date-time (timestamp).
Ok, if the user take care that the "system changed date-time" is always < "expiration date-time" but > "last started date-time".
It is steel possible to trick that, but it is one more check.
And This stored "last started date-time" is probablly better "last stoped date-time" - the last date-time which the apppllication know.
AuriiAuthor Commented:
This solution worked but its' not perfect solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.