Using the Chilkat Java Library in Eclipse
A step-by-step guide for adding the Chilkat Java library to an Eclipse 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 the build path
In Eclipse, right-click your project → Build Path → Configure Build Path…. On the Libraries tab, select Classpath, click Add External JARs…, and choose
chilkat.jar. Click Apply and Close.(Or copy
chilkat.jarinto alibfolder in your project, then right-click it → Build Path → Add to Build Path.) -
Point the JVM at the native library
The native library must be on the JVM's
java.library.pathat runtime. The easiest way in Eclipse is to set it on the JAR you just added:Expand
chilkat.jarin the Package Explorer, select Native library location, click Edit…, and choose the folder that contains the native library.Alternatively, add a VM argument in your Run Configurations → Arguments → VM arguments:
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. -
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 project (Run → Run As → Java Application). 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
Native library location on chilkat.jar (or the VM argument) in
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.
“The import com.chilkatsoft cannot be resolved”
chilkat.jar isn't on the build path. Re-add it under
Build Path → Configure Build Path → Libraries
(Step 2).
macOS: library blocked by Gatekeeper
Clear the quarantine attribute as shown above.