---
title: "License activation | Nutrient Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/license-activation/"
md_url: "https://www.nutrient.io/guides/java/license-activation.md"
last_updated: "2026-06-09T21:11:56.025Z"
description: "Activate your Nutrient Java SDK license before running SDK operations."
---

# License activation

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:

```java

package io.nutrient.Sample;

```

Import the required SDK classes:

```java

import io.nutrient.sdk.License;
import io.nutrient.sdk.Document;
import io.nutrient.sdk.exceptions.NutrientException;

public class LicenseActivation {

```

Create `main` and declare `NutrientException`:

```java

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

```

## Register the license key

Register the key before any other SDK usage:

```java

        // 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](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) so Java closes resources automatically:

```java

        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](https://www.nutrient.io/downloads/samples/java/license-activation.zip) to run the example locally.
---

## Related pages

- [Changelog for Java](/guides/java/changelog.md)
- [Java SDK sample downloads](/guides/java/downloads.md)
- [Java guides: Integrate our PDF SDK](/guides/java/intro.md)
- [Nutrient Java SDK](/guides/java.md)

