本文介绍了如何防止客户经常使用Demo Java程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个演示小程序,我希望将它传递给我的客户端,以便他可以运行它5次以检查其功能。它不是一个很大的软件,我实现了一些串行密钥功能并制作试用软件。

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.

我想要一个简单的解决方案,可以限制程序的使用更多超过5次或者可以在达到阈值限制后自行删除。

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.

我想到了一个解决方案。我通过相同的程序制作4个.txt文件并将它们存储在diff中。客户端计算机上的位置和这些文件将存储程序运行的次数。每次应用程序启动时,它都会检查所有这些文件,如果任何文件包含代表阈值限制的数字,则只需通过说已达到阈值限制就退出。

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.

推荐答案

如果你想让它变得更简单,请进行时间检查,不要让客户端运行代码从今天起五天或一周之后的时间已到期

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.

这篇关于如何防止客户经常使用Demo Java程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 20:15