Closed moritzfl closed 6 months ago
jna.library.path
can contain multiple paths, each is separated by File.pathSeparator
. JNA will check all those locations to find and load the native resources.
So if you have your own custom Tesseract native library in some directory, setting the variable will tell JNA to look there.
jna.library.path
can contain multiple paths, each is separated byFile.pathSeparator
. JNA will check all those locations to find and load the native resources.So if you have your own custom Tesseract native library in some directory, setting the variable will tell JNA to look there.
how set custom Tesseract. tess4j5.9/5.10 and Tesseract-OCR5.3.3.20231005 reslut are different, i need set custom Tesseract function please is windows system i set System.setProperty("jna.library.path", "D:\Tesseract-OCR"); or System.setProperty("jna.library.path", "D:\Tesseract-OCR\libtesseract-5.dll"); but result always different
@zymgg Make sure your custom DLL has the appropriate filename, which could vary based on the library version. Check LoadLibs
class for more details.
@zymgg Make sure your custom DLL has the appropriate filename, which could vary based on the library version. Check
LoadLibs
class for more details.
i see code, but i cant find my need, i create issue, help me please
The library is looking for a libtesseract533.dll
to load. If your custom native library is libtesseract-5.dll
, it won't be able to find it; you will have to change the referenced name in tess4j code. And it will require you to include all the dependencies (DLLs) that libtesseract-5.dll
requires, such as Leptonica, etc.
In the following code, the resources are extracted to the temp folder. This works if jna.library.path is not set to a custom value because in that case, Tess4j actually sets jna.library.path to the temp directory.
However if another value for jna.library.path is defined, the resources are still copied to the temp folder but the jna.library.path is then composed of
userCustomizedPath + File.pathSeparator + targetTempFolder.getPath()
which does not seem to make sense to me.The same behavior applies to Lept4j, but as of now, I have not opened an issue there ...