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
- JDK version — pick the build for your JDK (e.g. JDK 25, 21, 17, …).
- Architecture — arm64 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.
-
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, usetar xf chilkatjava-jdk<version>-<arch>-macosx.tarinstead. -
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.jargoes on the Java classpath;libchilkat.jnilibis the native library that must be on the java.library.path (the working directory, or a directory passed with-Djava.library.path). -
Check your JVM architecture
java -XshowSettings:properties -version 2>&1 | grep os.arch
os.arch = aarch64means an Apple Silicon JVM → use the arm64 download.os.arch = x86_64(oramd64) means an Intel/Rosetta JVM → use the x86_64 download. A mismatch causes anUnsatisfiedLinkError(see below). -
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 fromchilkat.jar, instantiates aCkZip, and prints its version:11.5.0For reference,
runTest.shruns:javac -encoding utf8 -classpath ".:./chilkat.jar" Test.java java -Djava.library.path=. -classpath ".:./chilkat.jar" Test
-
Use Chilkat in your own project
Put
chilkat.jaron the classpath and pointjava.library.pathat the folder containinglibchilkat.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.
-
Unlock (30-day trial / licensed classes)
Chilkat's commercially-licensed Java classes are fully functional for a 30-day trial. Call
UnlockBundleonce 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.