Chilkat2 Java
=============

Chilkat2 Java is the Java-style Chilkat API: package com.chilkatsoft.chilkat2, getX()/setX() accessors,
lowerCamel method names, exceptions (ChilkatException) instead of status codes, AutoCloseable objects and
lambda-friendly progress callbacks.  It is independent of the classic Chilkat Java API (com.chilkatsoft.CkXxx,
chilkat.jar); the two can be used side by side, even in the same program.

Requirements: Java 8 or later (any JDK or JRE, any vendor).  One native library serves every Java version.


What is in this archive
-----------------------

  chilkat2.jar            the classes (put it on the classpath)
  chilkat2java.dll        the native library: Windows
  libchilkat2java.so      the native library: Linux and Alpine Linux
  libchilkat2java.dylib   the native library: macOS (code-signed)
  chilkat2-sources.jar    the Java sources, for your IDE ("attach sources")
  chilkat2-javadoc.jar    the reference documentation (Javadoc), for your IDE ("attach Javadoc")
  Test.java, runTest.*    a quick check that everything loads
  license / SBOM files


Quick start
-----------

  Windows:               runTest.bat
  Linux, Alpine, macOS:  sh runTest.sh

which amounts to

  javac -cp chilkat2.jar Test.java
  java -Dchilkat2.library.path=. -cp .:chilkat2.jar Test        (Windows: -cp .;chilkat2.jar)


Where the native library is looked for
--------------------------------------

The first Chilkat2 object you create loads the native library, trying in this order:

  1. the directory given by -Dchilkat2.library.path=<dir>
  2. a classpath resource /com/chilkatsoft/chilkat2/native/<platform>/<library>, for applications that
     package the library inside their own jar.  <platform> is printed by Test.java (for example
     windows-x86_64, linux-x86_64, linux-musl-aarch64, macos-aarch64).  The library is extracted once to
     ~/.chilkat2/<version>/<platform>/ (override with -Dchilkat2.extract.dir=<dir>).
  3. java.library.path (-Djava.library.path=<dir>), the standard JNI search.

If none works, the UnsatisfiedLinkError lists every place that was tried.  Chilkat2Native.ensureLoaded()
can be called at startup to surface a loading problem early.


Using it
--------

  import com.chilkatsoft.chilkat2.*;

  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/");
  } catch (ChilkatException e) {
      System.out.println(e.getMessage());          // the method and the reason
      System.out.println(e.getLastErrorText());    // the full log
  }

Unlocking: call new Global().unlockBundle("<your unlock code>") once at startup.  Without a purchased
unlock code Chilkat runs as a 30-day trial.

Note on StringBuilder: the Chilkat class com.chilkatsoft.chilkat2.StringBuilder has the same simple name
as java.lang.StringBuilder.  With "import com.chilkatsoft.chilkat2.*" write the one you mean in full
(com.chilkatsoft.chilkat2.StringBuilder or java.lang.StringBuilder) where both are used.

Documentation and examples: https://www.chilkatsoft.com/
