Chilkat2 for Java — Downloads
Chilkat2 for Java is the Java-style Chilkat API: package com.chilkatsoft.chilkat2,
with getX()/setX() properties, methods that throw ChilkatException when they
fail, AutoCloseable objects for try-with-resources, and progress callbacks you can write as lambdas.
HTTP and REST, email, FTP, SFTP, SSH, zip, encryption, signatures, certificates, XML, JSON, sockets and more, on
Windows, Linux, Alpine Linux and macOS. Each download works with every JDK from Java 8 up (8, 11, 17,
21, 25, …) and from Kotlin.
new Http(),
http.quickGetStr(url), exceptions) is for new code. The classic library
(com.chilkatsoft.CkHttp, chilkat.jar, status codes) is unchanged and remains on the
Chilkat Java downloads page; the two can be used side by side, even in the same program.
See the differences.
Jump to: Which download? · Windows · Linux · Alpine Linux · macOS · Getting started · Using it in your project · How the native library is found · The API in brief · Troubleshooting
Documentation & Samples
- 📖 Chilkat2 Java Reference Documentation — every class, method and property with its Java signature
- 📦 In every download:
chilkat2-javadoc.jarandchilkat2-sources.jar, so your IDE shows the documentation and the source of every class as you type - 📝 Release Notes on the Chilkat blog
Which download do I need?
The download contains a native library, so match it to the operating system and the architecture of the JVM you will run (the JDK version does not matter). To see the JVM's architecture:
java -XshowSettings:properties -version 2>&1 | grep os.arch # Linux, macOS java -XshowSettings:properties -version 2>&1 | findstr os.arch :: Windows
Windows
- 64-bit JVM (
amd64)→ chilkat2-java-x64 - 32-bit JVM (
x86)→ chilkat2-java-win32 - ARM64 JVM (
aarch64)→ chilkat2-java-arm64
An x64 JVM running emulated on a Windows-on-ARM PC uses the x64 build.
Linux (glibc)
- x86_64 (
amd64)→ chilkat2-java-x86_64-linux - arm64 (
aarch64)→ chilkat2-java-aarch64-linux - 32-bit ARM (
arm)→ chilkat2-java-armv7l-linux
Raspberry Pi: 64-bit OS → arm64, 32-bit OS → armv7l.
Alpine Linux (musl)
- x86_64→ chilkat2-java-x86_64-alpine
- arm64→ chilkat2-java-aarch64-alpine
For Alpine-based Docker images (eclipse-temurin:*-alpine, …). The glibc
builds do not load on Alpine.
macOS
- Apple silicon (
aarch64)→ chilkat2-java-arm64-macosx - Intel (
x86_64)→ chilkat2-java-x86_64-macosx
An Intel JVM running under Rosetta on an Apple-silicon Mac needs the x86_64 build.
Windows
Each .zip contains a code-signed chilkat2java.dll for one architecture, linked with
the C runtime statically (no Visual C++ redistributable needed), plus chilkat2.jar.
Getting started →
Linux
For glibc-based distributions (Debian/Ubuntu, RHEL/Fedora, SUSE, Arch, Raspberry Pi OS, …). Each
.tar.gz contains libchilkat2java.so and chilkat2.jar. Alpine Linux uses musl
and needs the Alpine downloads below. Getting started →
Alpine Linux
Built for musl. Each .tar.gz contains libchilkat2java.so and chilkat2.jar.
Getting started →
macOS
Each .tar.gz contains a code-signed libchilkat2java.dylib and chilkat2.jar.
Apple silicon requires macOS 11 or later; Intel requires macOS 10.14 or later.
Getting started →
Getting started
The steps are the same on every operating system. Only three things differ:
| Windows | Linux, Alpine | macOS | |
|---|---|---|---|
| Archive | .zip | .tar.gz | .tar.gz |
| Native library | chilkat2java.dll | libchilkat2java.so | libchilkat2java.dylib |
| Classpath separator | ; | : | : |
-
Download and extract
tar xzf chilkat2-java-x86_64-linux.tar.gz # Linux / Alpine / macOS (your file name) # Windows: right-click the .zip → Extract All, or: tar -xf chilkat2-java-x64.zip # Windows 10 and later include tar
macOS only: if the browser added a quarantine attribute, clear it so Gatekeeper does not block the library:
xattr -dr com.apple.quarantine chilkat2-java-arm64-macosx
-
What's in the download
chilkat2-java-<platform>/ ├─ chilkat2.jar the classes: put it on the classpath ├─ chilkat2java.dll the native library (libchilkat2java.so / .dylib elsewhere) ├─ chilkat2-sources.jar attach in your IDE: source ├─ chilkat2-javadoc.jar attach in your IDE: documentation ├─ README.txt ├─ Test.java a small check that everything loads ├─ runTest.bat / runTest.sh compiles and runs Test.java └─ license.pdf, THIRD-PARTY-NOTICES.txt, … and a software bill of materials (chilkat.cdx.json)
-
Verify
Run
runTest.bat(Windows) orsh runTest.sh(Linux, Alpine, macOS) from the extracted folder. It compiles and runsTest.java, which prints the version, where the native library was loaded from, and the platform:Chilkat2 Java 11.7.0 native library: ./libchilkat2java.so platform: linux-x86_64
-
Compile and run your own program
Put
chilkat2.jaron the classpath, and tell Chilkat2 where the native library is with-Dchilkat2.library.path(the directory that contains it):javac -cp chilkat2.jar MyApp.java java -Dchilkat2.library.path=/opt/chilkat2 -cp .:chilkat2.jar MyApp # Linux, macOS java -Dchilkat2.library.path=C:\chilkat2 -cp .;chilkat2.jar MyApp :: Windows
No
System.loadLibrarycall is needed: the first Chilkat2 object you create loads the library.java.library.pathworks too, and the library can also travel inside your own jar (how the library is found). -
Unlock
Chilkat is fully functional for a 30-day trial. Call
unlockBundleonce when your program starts; any string starts the trial, and your purchased unlock code is used the same way:try (Global glob = new Global()) { glob.unlockBundle("Anything for 30-day trial"); }
A first program
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Global;
import com.chilkatsoft.chilkat2.Http;
public class MyApp {
public static void main(String[] args) {
try (Global glob = new Global()) {
glob.unlockBundle("Anything for 30-day trial");
}
// try-with-resources releases the native object when the block ends.
try (Http http = new Http()) {
http.setConnectTimeout(10);
http.onPercentDone(pct -> { System.out.println(pct + "%"); return false; });
String html = http.quickGetStr("https://www.chilkatsoft.com/");
System.out.println("HTTP " + http.getLastStatus() + ", " + html.length() + " chars");
} catch (ChilkatException e) {
System.out.println(e.getMessage()); // "Http.quickGetStr failed: <reason>"
System.out.println(e.getLastErrorText()); // the full log of the failed call
}
}
}
Using it in your project
Chilkat2 Java is not in a Maven repository; the jar comes from the download. In every case the jar goes on the
classpath, and the JVM that runs your program gets -Dchilkat2.library.path=<dir> (or the library is
bundled, below).
IntelliJ IDEA, Eclipse, VS Code
Add chilkat2.jar as a library of the project (IntelliJ: Project Structure → Libraries;
Eclipse: Build Path → Add External JARs; VS Code: Java Projects → Referenced Libraries),
attach chilkat2-sources.jar and chilkat2-javadoc.jar to it for documentation as you type,
and add -Dchilkat2.library.path=<dir> to the run configuration's VM options
(VS Code: "vmArgs" in launch.json).
Maven
Install the jar once into your local repository, then depend on it as usual:
mvn install:install-file -Dfile=chilkat2.jar -Dsources=chilkat2-sources.jar -Djavadoc=chilkat2-javadoc.jar \
-DgroupId=com.chilkatsoft -DartifactId=chilkat2 -Dversion=11.7.0 -Dpackaging=jar
<dependency>
<groupId>com.chilkatsoft</groupId>
<artifactId>chilkat2</artifactId>
<version>11.7.0</version>
</dependency>
For a team or CI, deploy the same jar to your organization's repository (Nexus, Artifactory,
GitHub Packages, …) with mvn deploy:deploy-file.
Gradle
dependencies {
implementation(files("libs/chilkat2.jar"))
}
tasks.withType<JavaExec>().configureEach {
jvmArgs("-Dchilkat2.library.path=${projectDir}/libs")
}
Kotlin
Kotlin uses the same jar. Accessors read as properties, use closes the object, and the progress
helpers take Kotlin lambdas:
Http().use { http ->
http.connectTimeout = 10
http.onPercentDone { pct -> println("$pct%"); false }
val html = http.quickGetStr("https://www.chilkatsoft.com/")
}
How the native library is found
The first Chilkat2 object you create loads the native library, trying in this order:
- the directory named by
-Dchilkat2.library.path=<dir>; - a library bundled in your own jar as the resource
/com/chilkatsoft/chilkat2/native/<platform>/<library>
(it is extracted once to ~/.chilkat2/<version>/<platform>/, or to the
directory named by
-Dchilkat2.extract.dir, and reused while it is unchanged); java.library.path(the standard JNI search).
Bundling is how you ship one self-contained jar: copy the library from each download you support into your project's resources under the platform name below (Maven/Gradle: src/main/resources/com/chilkatsoft/chilkat2/native/linux-x86_64/libchilkat2java.so, and so on), and no command-line option is needed at run time.
| Download | Platform directory | Library |
|---|---|---|
| chilkat2-java-x64 | windows-x86_64 | chilkat2java.dll |
| chilkat2-java-win32 | windows-x86 | |
| chilkat2-java-arm64 | windows-aarch64 | |
| chilkat2-java-x86_64-linux | linux-x86_64 | libchilkat2java.so |
| chilkat2-java-aarch64-linux | linux-aarch64 | |
| chilkat2-java-armv7l-linux | linux-armv7 | |
| chilkat2-java-x86_64-alpine | linux-musl-x86_64 | |
| chilkat2-java-aarch64-alpine | linux-musl-aarch64 | |
| chilkat2-java-arm64-macosx | macos-aarch64 | libchilkat2java.dylib |
| chilkat2-java-x86_64-macosx | macos-x86_64 |
Chilkat2Native.platform() returns the running JVM's platform string (Test.java prints it), and
Chilkat2Native.ensureLoaded() can be called at startup to report a loading problem early.
The API in brief
Same classes, same members, same behavior as every other Chilkat product; the reference documentation shows the exact Java signature of each.
| Chilkat2 Java | Classic Chilkat Java | |
|---|---|---|
| Package, classes | com.chilkatsoft.chilkat2.Http | com.chilkatsoft.CkHttp |
| Native library | loaded automatically (chilkat2java) | System.loadLibrary("chilkat") |
| Properties | getConnectTimeout() / setConnectTimeout(30) | get_ConnectTimeout() / put_ConnectTimeout(30) |
| Methods | http.quickGetStr(url) | http.quickGetStr(url) / QuickGetStr(url, CkString) |
| Failure | throws ChilkatException (message, getLastErrorText()) | returns false / null; read lastErrorText() |
| “Not found” | lookup methods such as xml.findChild(path) return null, no exception | returns null |
| Yes/no methods | json.hasMember(path) returns boolean, never throws | returns boolean |
| Strings and bytes | String, byte[] | also CkString, CkByteData |
| Lifetime | AutoCloseable: try-with-resources, close() | delete() or the garbage collector |
| Progress events | onPercentDone(pct -> …), onAbortCheck, onProgressInfo, or a ProgressListener | subclass CkHttpProgress etc. |
Async (*Async, Task) | not included; use your own threads or executors | included |
| Unlocking | new Global().unlockBundle(code) | new CkGlobal().UnlockBundle(code) |
Events run on the thread that called the method; returning true from abortCheck or
percentDone aborts the method, and setting setAbortCurrent(true) from another thread does
too. Use an object from one thread at a time.
Troubleshooting
UnsatisfiedLinkError: Chilkat2 Java … the native library … was not found- The message ends with every place that was tried. Point
-Dchilkat2.library.pathat the directory that contains the library (not at the file), or check the resource path if you bundle it. UnsatisfiedLinkErrormentioning a wrong architecture, ELF class, or mach-o- The download does not match the JVM: for example an x64 library with a 32-bit JVM, an arm64 library under a
Rosetta (x86_64) JVM, or a Linux (glibc) library on Alpine. Check
os.arch(above) and use the matching download. - macOS: the library “cannot be opened” or fails a code-signature check
- Clear the download's quarantine attribute:
xattr -dr com.apple.quarantine <extracted folder>. NoClassDefFoundError: com/chilkatsoft/chilkat2/…chilkat2.jaris not on the classpath of the JVM that runs the program (separator;on Windows,:elsewhere).- “reference to StringBuilder is ambiguous”
- Chilkat has a
StringBuilderclass. Withimport com.chilkatsoft.chilkat2.*, writecom.chilkatsoft.chilkat2.StringBuilderorjava.lang.StringBuilderin full, or import the Chilkat classes one by one. UnsupportedOperationException: CodeSign is available on Windows onlyCodeSignandScMinidriveruse Windows APIs and exist only in the Windows builds.