1. Prepare the product and license
Start with a node-locked license and an ordinary export feature. Add metered usage only after the basic authorization flow works.
Device quota counts current activations and is returned on release. Ordinary licenses remain counted while offline; floating licenses also return quota when their leases expire.
- Copy the Product ID from Console > Products. Open that product’s Signing public keys and paste every key ID/public key pair into the initialization code, replacing YOUR_PRODUCT_ID, YOUR_KEY_ID and YOUR_PUBLIC_KEY. Quick integration can generate these public code constants. No product configuration file is required; the SDK defaults to https://www.licentivo.com.
- In Quick integration, create or select a product. Enable a feature named export in its policy and prepare a test license.
2. Install the SDK
Publication verification is in progress.
3. Protect a real export
Move SDK startup into your application’s startup or activation handler. Read the customer key from your activation form, pass your own product ID and trusted keys, and keep the client alive until shutdown. Put RunFeature at the actual business entry point; replace the report writer with your own operation.
import licentivo.Client;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
/** A single protected operation. Keep Client alive while your application runs. */
public final class Quickstart {
// BEGIN LICENTIVO PRODUCT
// Copy Product ID and all key ID/public key pairs from Console > Products > Signing public keys.
private static final String PRODUCT_ID = "YOUR_PRODUCT_ID";
private static final Map<String,String> TRUSTED_KEYS = Map.of("YOUR_KEY_ID", "YOUR_PUBLIC_KEY");
// END LICENTIVO PRODUCT
private static String setting(String name, String fallback) {
String value = System.getenv(name);
return value == null || value.isEmpty() ? fallback : value;
}
static void exportReport(String path) throws Exception {
// Replace this write with your existing, non-metered export operation.
Files.writeString(Path.of(path), "A report generated by the licensed application.\n");
}
public static void main(String[] args) {
// In a GUI, read the activation input. Later starts pass an empty key.
try (var client = Client.openProduct(PRODUCT_ID, TRUSTED_KEYS,
setting("LICENTIVO_LICENSE_KEY", ""), error -> System.err.println("Background verification: " + error.getMessage()))) {
String feature = setting("LICENTIVO_FEATURE", "export");
String path = setting("LICENTIVO_OUTPUT", "licensed-report.txt");
if (setting("LICENTIVO_METERED", "").equals("1"))
client.runMeteredFeature(feature, 1, setting("LICENTIVO_OPERATION_ID", ""), () -> exportReport(path));
else
client.runFeature(feature, () -> exportReport(path));
System.out.println("License OK: " + feature + " is available\nExport completed: " + path);
} catch (Exception error) {
System.err.println(error.getMessage());
System.exit(2);
}
}
}
4. Keep the client alive until shutdown
This command-line example performs one operation and exits. In a desktop application, open one client at startup, invoke the feature callback from the export action, and close the client only when the application exits.
After activation, later starts can leave LICENTIVO_LICENSE_KEY empty and restore the private credential under the same user and cache location. Keep that credential in the user application-data directory. Closing stops heartbeats and returns floating seats; normal exit should not deactivate a node-locked device.
Offline access is available only when the policy permits it and the signed grant remains valid. An expired or denied feature must remain blocked. Metered operations require a network connection.
For Swing or JavaFX, start authorization off the UI thread and marshal background notifications onto the UI thread. Keep the owning Client alive through the window lifetime; try-with-resources closes it on exit.
5. Run and verify the result
Copy the Product ID from Console > Products. Open that product’s Signing public keys and paste every key ID/public key pair into the initialization code, replacing YOUR_PRODUCT_ID, YOUR_KEY_ID and YOUR_PUBLIC_KEY. Quick integration can generate these public code constants. No product configuration file is required; the SDK defaults to https://www.licentivo.com.
- Confirm that a valid license with export access creates licensed-report.txt.
- Clear LICENTIVO_LICENSE_KEY and run again using the same user account: the saved credential should restore.
- Set LICENTIVO_FEATURE to a feature absent from the license and LICENTIVO_OUTPUT to a fresh filename. The program must report a denial without creating that file.
- Test an offline restart only with a permitted, unexpired signed grant. Do not bypass a failed feature check after a background refresh error.
javac -cp licentivo-sdk-0.11.6.jar -d out Quickstart.java
$env:LICENTIVO_LICENSE_KEY = 'YOUR_LICENSE_KEY'
java -cp "out;licentivo-sdk-0.11.6.jar" Quickstartjavac -cp licentivo-sdk-0.11.6.jar -d out Quickstart.java
LICENTIVO_LICENSE_KEY=YOUR_LICENSE_KEY java -cp "out:licentivo-sdk-0.11.6.jar" QuickstartCommon integration problems
Check the product ID, every key ID/public key pair and the customer’s license input. Public verification keys belong to a product; customer licenses and saved device credentials are separate. Do not distribute development test keys or vendor management API keys.
Feature denied, device limit reached or license expired: inspect the license and policy in the console, then show the SDK error to the customer. A failed authorization must not call the export function.
RunFeature checks feature access; the metered variant reserves and settles configured usage. Use a stable operation ID per real business job and inspect its durable result before recovering an interrupted job.
Class not found: keep both out and the SDK JAR on the runtime classpath. Windows uses a semicolon between entries; Linux and macOS use a colon.