这个问题是针对 TrueLicense 的实现及其工作原理的。在教程的帮助下 here更有帮助here ,我已经能够使用 TrueLicense 成功地在我的软件上应用许可。但是,我对TrueLicense的某些方面以及它是如何工作的还不是很清楚,希望有人能赐教。现在,我不明白的是,当我调用
licenseManager.install()
方法(确保满足其余先决条件)许可证文件实际保存在哪里。我知道它以某种方式持续存在,因为我第二次启动应用程序并运行
licenseManager.verify()
它返回快乐的方法。我真的很感激对此有一些见解。
最佳答案
来自源代码 (TrueLicense):
/**
* Installs the given license key as the current license key.
* If {@code key} is {@code null}, the current license key gets
* uninstalled (but the cached license certificate is not cleared).
*/
protected synchronized void setLicenseKey(final byte[] key) {
final Preferences prefs = getLicenseParam().getPreferences();
if (null != key)
prefs.putByteArray(PREFERENCES_KEY, key);
else
prefs.remove(PREFERENCES_KEY);
}
如果您使用标准的 Java 首选项 API (java.util.prefs.Preferences),您将在 Windows 的注册表中看到它。在 Linux 和 OS X 上,有一个隐藏的“.”。具有这些 key 的目录。
通常,我只使用 userNodeForPackage方法,因为它不需要 Windows 上的管理员。
关于java - truelicense 在哪里保存许可证文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13734925/