Installing the Chilkat Java Library on macOS

How to add the Chilkat Java library to a project on macOS (Apple Silicon and Intel), plus the checks that prevent the common UnsatisfiedLinkError, Gatekeeper, and classpath problems.

Examples: Chilkat Java Examples  ·  Documentation: Chilkat Java Reference

Match the download to your JVM The Chilkat library includes a native JNI library, so the download must match:
  • JDK version — pick the build for your JDK (e.g. JDK 25, 21, 17, …).
  • Architecturearm64 for an Apple Silicon JVM, x86_64 for an Intel JVM. Note: on Apple Silicon a JVM can run under Rosetta as x86_64 — match the download to the JVM's architecture (Step 3), not to the Mac's chip.
  1. Download & extract

    Get the build for your Mac from the Chilkat macOS Java Downloads, then extract:

    tar xzf chilkatjava-jdk<version>-<arch>-macosx.tar.gz

    If the browser already decompressed it to a .tar, use tar xf chilkatjava-jdk<version>-<arch>-macosx.tar instead.

  2. What's in the download

    chilkatjava-jdk<version>-<arch>-macosx/
    ├─ chilkat.jar             the Chilkat Java classes (put on the classpath)
    ├─ libchilkat.jnilib       the native JNI library (put on java.library.path)
    ├─ Test.java               a small verification program
    ├─ runTest.sh              compiles and runs Test.java
    ├─ license.pdf
    ├─ pcre2-license.pdf
    ├─ quickjs-license.pdf
    └─ THIRD-PARTY-NOTICES.txt
    Two files, two roles: chilkat.jar goes on the Java classpath; libchilkat.jnilib is the native library that must be on the java.library.path (the working directory, or a directory passed with -Djava.library.path).
  3. Check your JVM architecture

    java -XshowSettings:properties -version 2>&1 | grep os.arch

    os.arch = aarch64 means an Apple Silicon JVM → use the arm64 download. os.arch = x86_64 (or amd64) means an Intel/Rosetta JVM → use the x86_64 download. A mismatch causes an UnsatisfiedLinkError (see below).

  4. Verify with runTest.sh

    From the extracted directory:

    ./runTest.sh

    It compiles and runs Test.java, which loads the native library (System.loadLibrary("chilkat")), loads the Chilkat classes from chilkat.jar, instantiates a CkZip, and prints its version:

    11.5.0

    For reference, runTest.sh runs:

    javac -encoding utf8 -classpath ".:./chilkat.jar" Test.java
    java -Djava.library.path=. -classpath ".:./chilkat.jar" Test
  5. Use Chilkat in your own project

    Put chilkat.jar on the classpath and point java.library.path at the folder containing libchilkat.jnilib (macOS uses : as the classpath separator):

    javac -classpath ".:path/to/chilkat.jar" YourApp.java
    java -Djava.library.path=path/to/jnilib -classpath ".:path/to/chilkat.jar" YourApp

    See also: Using System.loadLibrary to load a native .jnilib and JAR archives and classpath on macOS.

  6. Unlock (30-day trial / licensed classes)

    Chilkat's commercially-licensed Java classes are fully functional for a 30-day trial. Call UnlockBundle once at the start of your program (any string starts the trial; use your license code after purchase):

    import com.chilkatsoft.CkGlobal;
    
    CkGlobal glob = new CkGlobal();
    boolean success = glob.UnlockBundle("Anything for 30-day trial");
    if (success == false) {
        System.out.println(glob.lastErrorText());
    }

    The Chilkat Java library contains both freeware and commercial classes; each is marked in the reference documentation.


macOS Gatekeeper: clear the quarantine

A downloaded .jnilib carries a quarantine attribute that macOS may block, so loading fails with a code-signature / “cannot be opened” error. Clear it from the extracted folder before running:

xattr -dr com.apple.quarantine chilkatjava-jdk<version>-<arch>-macosx

Common errors

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

The JVM can't find libchilkat.jnilib. Run from the directory containing it, or pass -Djava.library.path=<dir> pointing at it.

“UnsatisfiedLinkError” mentioning a mach-o / architecture mismatch

The library's architecture doesn't match the JVM — an arm64 library under an x86_64 (Rosetta) JVM, or the reverse. Re-check Step 3 with os.arch and use the matching download. If macOS blocks the file with a code-signature error, clear the Gatekeeper quarantine (above).

“NoClassDefFoundError” / “ClassNotFoundException: com.chilkatsoft.CkZip”

chilkat.jar isn't on the classpath. Add it with -classpath ".:path/to/chilkat.jar" when compiling and running.