I am trying to create a desktop application in Java,
- It should not run in another machine than which I prefer.
- It should not run after a particular expiry data.
Is there any good idea to do so. Please help me. Thanks in advance.
According to my knowledge(very less) I have some suggestion:
For Point1: By Hard-coding my application's startUp to check for the ProcessorId(because it is unique one) If it is a valid one it should execute else show a "Expired" alert. But for doing this i should give a separate jar setUp to each user which i dont mind.
For Point2: Should maintain a encrypted file which will store the current date. During each startup of the application. I will update the date field in the file if the current date is greater than the one in the file. If not i will display a "Expired" alert.
This may look funny but this is what I can think.
Whatever you do, you'll need to obfuscate your code (at least) and encrypt/mangle any string literals you use. If you read processorId, you'll get angry calls from customers whose laptop just came in from service where they replaced the whole motherboard (very common practice today).
Any encrypted file can simply be deleted by a freeriding user. You must hide it somewhere good. On Windows people like playing this hide-and-seek game inside the Registry, especially its classid part.
Just some random ideas...