The Java FFM binding to the OCR engine built into the Windows 11 Snipping Tool. No JNI, nothing to compile.
Website · All repositories · Live output
- JDK 22+ (recommended - FFM is final, no preview flags needed)
- JDK 21 (alternative - FFM is preview, requires
--enable-preview; for building use-P build-jdk21) - Windows 11 with SnippingTool
# JDK 22+ (recommended)
mvn clean package
# JDK 21 (requires preview features)
mvn clean package -P build-jdk21# JDK 22+
java --enable-native-access=oneocr.api -jar target/oneocr-api-2.0.jar
# JDK 21
java --enable-preview --enable-native-access=oneocr.api -jar target/oneocr-api-1.0-jdk21.jar# Performance comparison (auto-detects JDK versions)
java TestJDK21JDK22Plus.java
# Simple test
java --enable-native-access=oneocr.api -cp "target/classes;target/test-classes" oneocr.api.test.SimpleOcrTestFor development, extract from C:\Program Files\WindowsApps\Microsoft.ScreenSketch_11.<version>_x64__8wekyb3d8bbwe\SnippingTool (e.g., C:\Program Files\WindowsApps\Microsoft.ScreenSketch_11.2409.25.0_x64__8wekyb3d8bbwe\SnippingTool):
oneocr.dlloneocr.onemodelonnxruntime.dllopencv_world4120.dll
Copy to src/main/resources/natives/ folder.
Extraction Notes: WindowsApps folder is owned by TrustedInstaller. To extract files:
- Take ownership temporarily (right-click folder → Properties → Security → Advanced → Change → enter your username)
- Copy required DLL files to
src/main/resources/natives/ - CRITICAL: Restore ownership to TrustedInstaller ( Warning: Improper ownership changes can break Windows Store apps. See proper reference such as : WindowsApps Permissions Guide )
At runtime, native libraries are automatically extracted to <userhome>/oneocr/ and loaded. Built JARs include all dependencies.
Design: This API module provides portable, bare-minimum OCR functionality for building custom applications. For ready-to-use command-line tools, see the Tools module.
- Tools: oneocr-cli
- Original: win11-oneocr