GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - oneocr/api: Java FFM (Foreign Function & Memory API) wrapper for Windows 11 SnippingTool OCR engine.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
references-and-examples
references-and-examples
 
 
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
TestJDK21JDK22Plus.java
TestJDK21JDK22Plus.java
 
 
pom.xml
pom.xml
 
 

Repository files navigation

oneocr

oneocr-api

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


Requirements

  • 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

Build

# JDK 22+ (recommended)
mvn clean package

# JDK 21 (requires preview features)
mvn clean package -P build-jdk21

Usage (API)

# 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

Testing

# 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.SimpleOcrTest

Native Libraries Setup (Development)

For 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.dll
  • oneocr.onemodel
  • onnxruntime.dll
  • opencv_world4120.dll

Copy to src/main/resources/natives/ folder.

Extraction Notes: WindowsApps folder is owned by TrustedInstaller. To extract files:

  1. Take ownership temporarily (right-click folder → Properties → Security → Advanced → Change → enter your username)
  2. Copy required DLL files to src/main/resources/natives/
  3. CRITICAL: Restore ownership to TrustedInstaller ( Warning: Improper ownership changes can break Windows Store apps. See proper reference such as : WindowsApps Permissions Guide )

Runtime Behavior

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.

Related

  • Tools: oneocr-cli
  • Original: win11-oneocr

About

Java FFM (Foreign Function & Memory API) wrapper for Windows 11 SnippingTool OCR engine.

Topics

javajava-ffijava-ffmjava21java22ocroneocropencvoptical-character-recognitionsnipping-toolwindows11

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.