Smart and powerful OCR tools

OCR in Java

The Nicomsoft OCR library (NSOCR) is a set of native x86/x64 binary files and data files. To use such a library in Java, you need a proxy library developed in compliance with the Java Native Interface (JNI). In NSOCR SDK, we have included the "JNSOCR" proxy library that implements the JNE interface and works between the Java virtual machine and the NSOCR native library.

Using NSOCR in Java

The JNSOCR proxy library and the NSOCR package are distributed with the complete source code.


How to use Nicomsoft OCR in Java

First, copy the directory with the NSOCR binaries (the "Bin" and/or "Bin_64" folders) to some directory (for example, "c:\MyProject\nsocrbin" or "/home/mike/MyProject"), or to the system directory ("/lib" or "/usr/lib"). Then specify the path to jnsocr with the key "Djava.library.path".

Example: How to start a compiled application


java -Djava.library.path=../../../Bin -jar dist/sample.jar


start /MIN java -Djava.library.path=../../../Bin -jar dist\sample.jar

To use NSOCR in your Java application, add the NSOCR package files to your project:


Then import all classes of the NSOCR package. The main class of the Java NSOCR API is called "NSOCR.Engine". Its methods are identical to the NSOCR API functions. Please refer to the "Docs" directory or to online help for documentation about NSOCR API functions, their parameters, and examples.

To debug a Java application in the IDE, you also need to set "Djava.library.path" in the IDE settings:


For detailed Java sample code that demonstrates the use of NSOCR in Java, see the sample project “Java Advanced Sample” that is included in the NSOCR SDK.


Notes and Limitations

Java applications are cross-platform and can work in different operating systems. However, using JNE (Java Native Interface) causes some limitations. Applications will work correctly only if all necessary native libraries are installed in the system and Java Virtual Machine is configured properly. Currently the NSOCR library can be used in Windows x86, Windows x64, Linux x86, and Linux x64. Other platforms are not supported yet.