License4J Library easyValidate Integration
There are two new methods at version 4.5.4+; easyValidate and easyValidateOnStartup. These are for easily validating and activating license. They also save an encrypted license file in user home folder, and load when needed. Both requires an encrypted string which includes all required parameters. This string is generated by License Manager GUI. License template management window generates this string and also source code for selected template.
To get the source code, select your product and click on "Manage License Templates" window; create a template
if you don't already have one. Use actions menu to get source code as in the following screen shot.
easyValidate method should be used in a licensing windows/dialog to validate license supplied by user. easyValidateOnStartup method should be used in main method or after software product is started to check for license already saved on disk.
Sample CodeFollowing code is available in example12. A single call to easyValidate is sufficient to validate, activate and save license on disk.
/** * The first argument is the license key or text to validate. * The second argument is an encrypted string unique to each license template. * It is generated by License Manager GUI on license template management window. * * It is for supplied license validation, and should be called after getting license input from user. */ License license = LicenseValidator.easyValidate(licenseStringToValidate, "1c28t289t18897k..."); /** * There is only one arguement; it is the string generated by License Manager. * * This method is for validating and activating license file on disk. */ License license = LicenseValidator.easyValidateOnStartup("1c28t289t18897k...");