The Java SDK is the primary production integration path. The CLI is the try/debug/inspect path: it lets a Java team verify the core promise before writing integration code:
document -> parsed sections with source locations -> schema check -> audit output
Use the SDK when adding DocTruth to an application:
<dependency>
<groupId>ai.doctruth</groupId>
<artifactId>doctruth-java</artifactId>
<version>0.2.0-alpha</version>
</dependency>Minimal application flow:
var result = DocTruth.withOpenAi(System.getenv("OPENAI_API_KEY"))
.fromPdf(Path.of("contract.pdf"))
.extract("Extract contract terms", Contract.class)
.withEvidence()
.run();Requires Java 25+ and Maven.
Build the standalone jar:
mvn -f java/pom.xml package -DskipTestsRun it directly:
java -jar java/target/doctruth-java-0.2.0-alpha-all.jar --helpInstall a doctruth launcher:
scripts/install-cli.sh --prefix "$HOME/.local"Make sure the install prefix is on your path:
export PATH="$HOME/.local/bin:$PATH"Check the install:
doctruth version
doctruth doctor
doctruth parse examples/no-llm-parse/sample-contract.csvIf java is not on PATH, point the launcher at your Java 25 runtime:
JAVA=/path/to/java doctruth versionOn macOS, /usr/bin/java may be a stub even when Maven can find a Homebrew JDK.
In that case set JAVA_HOME and prepend it to PATH:
export JAVA_HOME=/opt/homebrew/opt/openjdk/libexec/openjdk.jdk/Contents/Home
export PATH="$JAVA_HOME/bin:$PATH"
java -versionNo provider key is required for parser and schema inspection:
doctruth parse examples/no-llm-parse/sample-contract.csv
doctruth parse examples/no-llm-parse/sample-contract.csv --json -o parsed.json
doctruth schema examples/pydantic-interop/resume.schema.jsonThis is the recommended first-run path. It proves the document evidence surface before a user spends time configuring model keys.
Extraction requires a provider key:
export OPENAI_API_KEY=...
doctruth extract contract.pdf -s contract.schema.json
doctruth audit .doctruth/runs/<run-id>/audit.jsonUse --provider, --model, and --base-url only when the defaults are not
enough.
The CLI and SDK use the same parser, citation, provenance, and audit primitives.
Tagged releases attach CLI artifacts:
doctruth-<version>.tar.gz
doctruth-java-<version>-all.jar
checksums.txt
doctruth.rb
Use the tarball when you want a bin/doctruth launcher plus the bundled jar:
tar -xzf doctruth-0.2.0-alpha.tar.gz
JAVA=/path/to/java ./doctruth-0.2.0-alpha/bin/doctruth versionUse the all-jar when you want the simplest direct invocation:
java -jar doctruth-java-0.2.0-alpha-all.jar versionThe release workflow generates a formula for the doctruthhq/homebrew-tap
repository. Once the tap is updated:
brew tap doctruthhq/tap
brew install doctruth
doctruth version
doctruth doctorSee Homebrew Distribution for maintainer details.