---
product: Chilkat
product_version: 11.7.0
language: ckjava
language_label: Java
document: language guide
---
> Chilkat 11.7.0 · language=ckjava · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckjava/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckjava/classes/<Class>.md`

# Chilkat for Java — language guide — v11.7.0

## 1. Which Chilkat binding this is

This is the **Chilkat Java library** (`chilkat.jar` + one native JNI library): package `com.chilkatsoft`, classes `CkHttp`, `CkZip`, `CkBinData`, … Properties are accessed through methods: getters are lowercase-initial (`http.lastErrorText()`, `http.get_LastStatus()` for non-string properties), setters are `put_Xxx(...)` (`http.put_Port(443)`). One download per OS and CPU works with every JDK from Java 8 up; Android uses the same classes with per-ABI JNI libraries. (A second, newer binding "Chilkat2 Java" with a different spelling is in preparation; when it is published it has its own reference under `java2/`. Code that uses `CkHttp` and `put_Xxx()` is this binding.)

## 2. Install and requirements

Download the package for your OS/CPU from [https://www.chilkatsoft.com/java.asp](https://www.chilkatsoft.com/java.asp) (Windows, Linux, Alpine, macOS, Android), add `chilkat.jar` to the classpath and put the native library (`chilkat.dll` / `libchilkat.so` / `libchilkat.dylib`) on `java.library.path`. IDE guides for IntelliJ, Eclipse and VS Code are linked from that page.

```java
import com.chilkatsoft.*;

static {
    System.loadLibrary("chilkat");   // once, before any Chilkat class is used
}
```

## 3. Unlocking and object creation

```java
// Required once per process, before any other Chilkat object. Any string unlocks a 30-day trial.
CkGlobal glob = new CkGlobal();
boolean success = glob.UnlockBundle("Anything for 30-day trial");
if (!success) {
    System.out.println(glob.lastErrorText());
    return;
}

CkHttp http = new CkHttp();
```

- Unlocking only sets a flag in memory: no license files, no network call, so the call is repeated each time the program runs. Extra calls are harmless no-ops; the `Global` object can be discarded afterwards.
- If a program forgets to unlock, Chilkat runs in trial mode and stops working when the trial expires — always include the call, and use the purchased unlock code in production.
- `UnlockBundle` unlocks every class; per-class `UnlockComponent` methods exist only in old code.

## 4. Error model

Chilkat methods **do not throw** for Chilkat-level failures. The note under each method on the class page says how it reports failure. String-producing methods come in two forms: an uppercase form with a `CkString` output argument that returns `boolean` (`http.QuickGetStr(url, ckStr)`), and a lowercase-initial form that returns the `String` directly and returns `null` on failure (`String s = http.quickGetStr(url)`). Object-returning methods return `null` on failure; boolean status methods return `false`; for an `int` result check `get_LastMethodSuccess()`. `lastErrorText()` holds the diagnostic in every case. `UnsatisfiedLinkError` at startup means the native library was not found on `java.library.path`.

Literals in Java: true is `true`, false is `false`, null/none is `nil`.

## 5. Strings, bytes and encodings

- Strings are Java `String`; a `charset` argument names the encoding of the *bytes* being produced or read.
- Binary data: methods take and return `CkByteData` (and `BinData` for the `Bd` methods); `byte[]` is obtained with `getBytes()` / `appendBytes(...)` on `CkByteData`.
- The lowercase-initial method form returns the value; the uppercase form fills a `CkString`/`CkByteData` argument and returns `boolean`. Use whichever is convenient; both exist for every string-producing method.
- Methods with `2`/`3` suffixes or `Quick*` prefixes are distinct members, not overloads.

## 6. Object lifetime and threading

Each `Ck*` object wraps a native object released by the garbage collector (through a finalizer). For deterministic release of large objects, drop references early.

A Chilkat object may be used from any thread, but **one object must not be used by two threads at the same time**: create one object per thread or protect it with a lock. Objects are independent — there is no shared global state other than the unlock flag and the few `Global` settings.

## 7. Progress callbacks and async

Progress events are supported: see the "Events and callbacks" section of a class page for the event list and how to attach a handler in this binding (AbortCheck, PercentDone, ProgressInfo and TaskCompleted are the standard ones). Every method with an "Async variant" line also has an `XAsync` twin that returns a `Task` immediately; poll `Finished` or use the `TaskCompleted` event, then read the result from the task. No new Async methods are added from 11.7.0 on. In Java, events are received by subclassing the class's progress class (e.g. `CkHttpProgress`), overriding the event methods, and passing an instance to `put_EventCallbackObject(...)`; see the "Events and callbacks" section of a class page.

## 8. Common mistakes an AI makes with this binding

1. Using property syntax (`http.Port = 443`, `http.LastErrorText`) — in this binding it is `http.put_Port(443)` and `http.lastErrorText()`.
2. Forgetting `System.loadLibrary("chilkat")`, or calling it after a `Ck*` object was already created.
3. Mixing in Chilkat2-Java or .NET spelling (`Http` without `Ck`, `Chilkat.Http`).
4. Omitting `Global.UnlockBundle` (the program runs in trial mode and stops working after 30 days).
5. Inventing members by analogy with other libraries. If a member is not on the class page, it does not exist — look it up rather than guessing.
6. Using deprecated members that older examples still show. The class page lists each one with its replacement; `deprecated.md` lists them all.
7. Ignoring the failure path. Every Chilkat method reports failure (see each method's note); `LastErrorText` says why, and printing it is the first debugging step.
8. Using one Chilkat object from two threads at the same time. Create one object per thread, or protect it with a lock.

## 9. Instructions block for coding agents

Paste into `CLAUDE.md`, `.cursor/rules`, or Copilot instructions:

```
This project uses Chilkat 11.7.0 from Java (chilkat.jar + native JNI library, package com.chilkatsoft, classes CkHttp, CkZip, ...).
- Reference: https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckjava/ — read guide.md once, then classes/<Class>.md for each class used.
- Call System.loadLibrary("chilkat") and new CkGlobal().UnlockBundle(...) once at startup.
- Properties are methods: put_Xxx(v) to set, get_Xxx() or the lowercase-initial getter (lastErrorText()) to read.
- Chilkat methods never throw on failure: check the boolean/null result and print obj.lastErrorText().
- Never use a member that is not on the class page; never use members listed as deprecated.
```

## 10. Classes

[Class index for Java](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckjava/index.md)
