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 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.)
-
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.jarinto alibfolder in your project, right-click it, and choose Add as Library.) -
Tell the JVM where the native library is
The native library must be on the JVM's
java.library.pathat 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. -
Load the library, unlock, and use Chilkat
Load the native library once (a
staticblock 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()); } }
-
Run
Run the configuration. If the Chilkat version prints, the JAR and native library are both set up correctly.
Native library by platform
| Platform | Native library | Notes |
|---|---|---|
| Windows | chilkat.dll | x64 build for a 64-bit JVM, win32 for a 32-bit JVM |
| Linux | libchilkat.so | Match the CPU architecture (x86_64, aarch64, …) |
| macOS | libchilkat.jnilib | arm64 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.