How to prevent the use of the Demo Java program from my client?

I made a small small program that I want to deliver to my client so that he can run it 5 times to test its functionality. This is not a big software, for which I implement some functions of the serial key and create trial software.

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

One solution appeared in my mind. I make 4 .txt files through the same program and save them in diff. locations on the client computer, and these files will be stored the number of times the program was launched. Each time the application starts, it checks all of these files, and if any file contains a number representing the threshold limit, it simply exits, saying that the threshold limit has been reached.

Is there an even better solution, but simple, to limit the client to use different times?

It would be even better if the program is removed after the threshold limit.

+5
source share
7 answers

, , , , , .

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 clock, fetch time from some reliable time server
if( now.after(expiry)){
// Exit with proper expiry message
}
else
{ 
// let the customer enjoy your software
} 

, .

+7

Java Web Start JNLP , . JNLP, .

, , , .

+3

Remote Desktop VNC.

+1

Windows

, . , , , ;

, , .

, , , . , , . 3 :

  • , , , .

  • , , , .

  • , . .

    // public static Preferences userPref = Preferences.userRoot();

    // userPref.put( "keyName", "value" );

    // String read = userPref.get(, "0" );

+1

4 ( , ) . , , .

, .

0

, .

  • ,

class {

prop uid = HOSTNAME; prop MaxUsage = 5; prop AlreadyUsed = 5;

}

  1. Serializable, HOSTNAME, . http://www.java2s.com/Code/Java/File-Input-Output/Serializerclass.htm

  2. .

  3. , uid HOSTNAME , . AlreadyUsed , .

  4. , , , , , , , uid HOSTNAME == 0

- JavaWebstart, .

, .

0

"" -, .

0

All Articles