JiaJiaOCR: Pure Java OCR Skips Python and GPU, Packs Models Into the JAR
Java backend teams get an OCR option that avoids Python sidecars and GPU provisioning; the single-JAR model packaging and thread-safe API make it a drop-in for Spring services, including on restricted or domestic OS environments.
JiaJiaOCR is a pure Java OCR engine built on ONNX Runtime and OpenCV, with no JNI, no EXE/DLL, and no Python runtime. It runs on CPU, officially recommended over GPU, and ships models inside the JAR with lazy loading; a single instance is thread-safe for concurrent batch recognition. Beyond general text recognition, it handles Chinese handwriting with a claimed 92%+ accuracy on standard datasets, layout detection, table detection and recognition that outputs HTML and structured JSON, and multi-page PDF OCR.
Installation requires building the project yourself because it's not on Maven Central: run mvn clean package -DskipTests, add onnxruntime, opencv, pdfbox and commons-lang3 dependencies, then download models from the GitHub releases page and place them on the classpath. A sample test calls recognizeGeneralText with try-with-resources and prints recognized text. The GitHub repo has other examples, and the project sits at 105 stars.
The 92%+ handwriting accuracy claim against Tesseract arrives without benchmark methodology, so it reads as a marketing number rather than a verified result.
Bundling ONNX Runtime and OpenCV as Maven dependencies sidesteps the native-library setup that usually trips up Java OCR, but a 105-star project absent from Maven Central demands a build-and-test pass before any production commitment.
CPU-first operation and lazy model loading match the reality of most Java backend deployments, where GPU access is rare and startup memory is a real constraint.