This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/java/license-activation.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. License activation | Nutrient Java SDK

Activate the Nutrient Java SDK license before you run any other SDK operation. This startup step authorizes your application and enables the features tied to your license.

Activate a license in the Java SDK

Call License.registerKey() once during startup, before you use other SDK APIs.

Prepare the project

Define a package and class:

package io.nutrient.Sample;

Import the required SDK classes:

import io.nutrient.sdk.License;
import io.nutrient.sdk.Document;
import io.nutrient.sdk.exceptions.NutrientException;
public class LicenseActivation {

Create main and declare NutrientException:

public static void main(String[] args) throws NutrientException {

Register the license key

Register the key before any other SDK usage:

// Replace the empty string with your license key: License.registerKey("YOUR_LICENSE_KEY_GOES_HERE");
License.registerKey("");

After registration, you can call document APIs.

Use the SDK after activation

Use Document inside a try-with-resources statement(opens in a new tab) so Java closes resources automatically:

try (Document document = Document.open("input.pdf")) {
document.exportAsPdf("output.pdf");
}
}
}

Handle errors

Nutrient Java SDK raises NutrientException when an SDK call fails. You can declare it in method signatures, as shown above, or catch it with try/catch for custom handling.

Summary

The activation flow has two steps:

  1. Register the license key.
  2. Run SDK operations.

Download this sample package to run the example locally.