質問

This question is very specific to the implementation of TrueLicense and its workings. With the help of the tutorials here and the more helpful here, I have successfully been able to apply licensing on my software using TrueLicense. However, I am still not clear on certain aspects of TrueLicense and how it works, and am hoping somebody can enlighten me. For now, what I don't understand is that when I call the

licenseManager.install() 

method (making sure the rest of the prerequisites are fulfilled) where is the license file actually getting persisted. I know that it is getting persisted somehow because the second time I start the application and run the

licenseManager.verify() 

method it returns happy. I would really appreciate some insight on this.

役に立ちましたか?

解決

From the source-code (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);
}

If you use the standard Java preferences API (java.util.prefs.Preferences), you will see this in the registry on Windows. On Linux and OS X, there is a hidden "." directory that has these keys.

Typically, I just use the userNodeForPackage method, since it does not require an admin on Windows.

他のヒント

Open regedit tool; Under HKEY_CURRENT_USER/Software/JavaSoft/Prefs/{$the.package.of.your.license.classes}.

Note: this is only for windows and is the default behaviour. (with original PREFERENCES_KEY value)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top