Applying Licenses to Projects in IronPDF for Java

How to Get a License Key

Adding an IronPDF license key allows you to deploy your project live without restrictions or watermarks.

You can purchase an IronPDF license or sign up for a free 30-day trial license.

Step 1: Define IronPDF as a Java Dependency

Option 1: pom.xml Dependency

To define IronPDF as a dependency, please add the following to your pom.xml:

<dependencies>
    <!-- Adds IronPDF Java. Use the latest version in the version tag.-->
    <dependency>
        <groupId>com.ironsoftware</groupId>
        <artifactId>ironpdf</artifactId>
        <version>20xx.xx.xxxx</version>
    </dependency>

    <!-- Adds the slf4j logger which IronPDF Java uses. -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.3</version>
    </dependency>
</dependencies>
<dependencies>
    <!-- Adds IronPDF Java. Use the latest version in the version tag.-->
    <dependency>
        <groupId>com.ironsoftware</groupId>
        <artifactId>ironpdf</artifactId>
        <version>20xx.xx.xxxx</version>
    </dependency>

    <!-- Adds the slf4j logger which IronPDF Java uses. -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.3</version>
    </dependency>
</dependencies>
XML

Option 2: Download the jar file

Optionally download the IronPDF Java .jar file manually.

Step 2: Apply Your License Key

Option 1: Apply license key in Java code

Add this code to the startup of your application, before IronPDF is used. This method is universally effective and straightforward.

import com.ironsoftware.ironpdf.License;

public class MyApplication {
    public static void main(String[] args) {
        // Apply your license key
        License.setLicenseKey("IRONPDF-MYLICENSE-KEY-1EF01");

        // Start using IronPDF!
    }
}
import com.ironsoftware.ironpdf.License;

public class MyApplication {
    public static void main(String[] args) {
        // Apply your license key
        License.setLicenseKey("IRONPDF-MYLICENSE-KEY-1EF01");

        // Start using IronPDF!
    }
}
JAVA

Option 2: Apply license in config.properties config file

Add the following to your config.properties file:

IRONPDF_LICENSE_KEY=IRONPDF-MYLICENSE-KEY-1EF01

Step 3: Test if your key has been installed correctly

Here's how you can test the validity of your license key in Java code:

import com.ironsoftware.ironpdf.License;

public class LicenseTest {
    public static void main(String[] args) {
        String licenseKey = "IRONPDF-MYLICENSE-KEY-1EF01";

        // Check if the given license key string is valid
        boolean isValid = License.isValidLicense(licenseKey);

        if (isValid) {
            System.out.println("License key is valid.");
        } else {
            System.out.println("License key is invalid.");
        }
    }
}
import com.ironsoftware.ironpdf.License;

public class LicenseTest {
    public static void main(String[] args) {
        String licenseKey = "IRONPDF-MYLICENSE-KEY-1EF01";

        // Check if the given license key string is valid
        boolean isValid = License.isValidLicense(licenseKey);

        if (isValid) {
            System.out.println("License key is valid.");
        } else {
            System.out.println("License key is invalid.");
        }
    }
}
JAVA

Note: After adding a license, always remember to clean and republish your application to avoid potential mistakes in deployment.

Step 4: Get started with your project

Follow our tutorial on how to Get Started with IronPDF for Java Projects.

Questions?

IronPDF for Java is free to use and test in development environments with an IronPDF watermark applied.

To use in live projects and remove the watermark, acquire a live project license. 30-day trial licenses are also available for testing purposes.

For our full list of code examples, tutorials, licensing information, and documentation visit: IronPDF Java Documentation.

For more support and inquiries, please contact our support team.

Frequently Asked Questions

How can I get a license key for the software?

You can purchase an IronPDF license or sign up for a free 30-day trial license from the IronPDF licensing page.

How do I add the library as a dependency in my Java project?

You can define IronPDF as a dependency by adding it to your pom.xml file or by downloading the IronPDF Java .jar file manually.

How can I apply my license key in Java code?

To apply your license key in Java code, add the code to the startup of your application using License.setLicenseKey("YOUR-LICENSE-KEY").

How can I apply my license key using a config file?

Add your license key to the config.properties file using the format IRONPDF_LICENSE_KEY=YOUR-LICENSE-KEY.

How do I test if my license key is valid?

You can test the validity of your license key by using the License.isValidLicense function in your Java code.

Is the library free to use?

IronPDF for Java is free to use and test in development environments with a watermark. To use in live projects without a watermark, a live project license is required.

Where can I find more resources and support for the software?

You can find more code examples, tutorials, licensing information, and documentation on the IronPDF Java Documentation page. For further support, contact the IronPDF support team.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.
Talk to an Expert Five Star Trust Score Rating

Ready to Get Started?