Using the Chilkat Java Library in IntelliJ IDEA

A step-by-step guide for adding the Chilkat Java library to an IntelliJ IDEA project on Windows, Linux, and macOS. The Chilkat Java library has two parts — a JAR (the classes) and a native library — and both must be set up.

Examples: Chilkat Java Examples  ·  Documentation: Chilkat Java Reference

Download the matching build The native library must match your environment: the build for your JDK version, your operating system, and your JVM architecture (64-bit vs 32-bit; on macOS, Apple Silicon vs Intel). See Chilkat Java Downloads.
  1. Download and unzip the Chilkat Java library

    From Chilkat Java Downloads, get the build for your OS and JDK, and unzip it. Each download contains the JAR and the platform's native library:

    chilkat.jar                 the Chilkat Java classes
    chilkat.dll                 native library (Windows)
    libchilkat.so              native library (Linux)
    libchilkat.jnilib          native library (macOS)

    (Your download contains the JAR plus the one native library for your platform.)

  2. Add chilkat.jar to your project

    In IntelliJ IDEA, open File → Project Structure → Libraries, click +Java, and select chilkat.jar. Apply it to your module when prompted.

    (Alternatively, copy chilkat.jar into a lib folder in your project, right-click it, and choose Add as Library.)

  3. Tell the JVM where the native library is

    The native library must be on the JVM's java.library.path at runtime. In IntelliJ, edit your Run/Debug Configuration and add a VM option pointing at the folder that contains the native library:

    Windows
    -Djava.library.path=C:\path\to\chilkat
    Linux / macOS
    -Djava.library.path=/path/to/chilkat

    Point it at the directory containing chilkat.dll / libchilkat.so / libchilkat.jnilib — not at the file itself.

    If you don't see VM options, click Modify options → Add VM options in the Run/Debug Configuration dialog.
  4. Load the library, unlock, and use Chilkat

    Load the native library once (a static block is convenient), unlock, then use any Chilkat class:

    import com.chilkatsoft.CkGlobal;
    import com.chilkatsoft.CkZip;
    
    public class Main {
    
        static {
            System.loadLibrary("chilkat");   // no "lib" prefix, no extension
        }
    
        public static void main(String[] args) {
            CkGlobal glob = new CkGlobal();
            glob.UnlockBundle("Anything for 30-day trial");
    
            CkZip zip = new CkZip();
            System.out.println(zip.version());
        }
    }
  5. Run

    Run the configuration. If the Chilkat version prints, the JAR and native library are both set up correctly.


Native library by platform

PlatformNative libraryNotes
Windowschilkat.dllx64 build for a 64-bit JVM, win32 for a 32-bit JVM
Linuxlibchilkat.soMatch the CPU architecture (x86_64, aarch64, …)
macOSlibchilkat.jnilibarm64 for Apple Silicon, x86_64 for Intel

In all cases, System.loadLibrary("chilkat") is the same — the JVM adds the correct prefix/extension for the platform.


macOS: clear the Gatekeeper quarantine

On macOS, a downloaded libchilkat.jnilib may be blocked by Gatekeeper with a code-signature / “cannot be opened” error. Clear the quarantine attribute:

xattr -dr com.apple.quarantine /path/to/chilkat

Common errors

“UnsatisfiedLinkError: no chilkat in java.library.path”

The native library folder isn't on java.library.path. Re-check the VM option in your Run/Debug configuration (Step 3) and confirm it points at the directory containing the native library.

“UnsatisfiedLinkError” about a wrong architecture / ELF class / mach-o

The native library doesn't match the JVM. Make sure the download matches your JVM's architecture (64-bit vs 32-bit; on macOS, arm64 vs x86_64). Check with java -version / os.arch.

“package com.chilkatsoft does not exist” / cannot resolve Chilkat classes

chilkat.jar isn't on the project's classpath. Re-add it under Project Structure → Libraries (Step 2) and make sure it's attached to your module.

macOS: library blocked by Gatekeeper

Clear the quarantine attribute as shown above.


← Chilkat Java Downloads