I am using Java API and my project is Maven project. I have installed com.abbyy.FREngine.jar into local repository. Everything was fine until I didn't try to run my code. I get following exception
At first I wasn't sure what went wrong, because same code was working fine before I have put com.abbyy.FREngine into Maven repository, but after much hours spend digging what is wrong I have decided to decompile com.abbyy.FREngine.jar. What I have found there was really disturbing. You guys are unpacking jar file it self and are using URLClassLoader to get all loaded jar and then you are matching you jar by the name which in my case is changed to com.abbyy.FREngine-11.jar (because of Maven).
This is very bad practice from various reasons.And this absolutely blocks anyone who use Maven. You could simply use getClass().getResourceAsStream(name) to get necessary dlls.
Please advice how to proceed further.
Solution for this is simple but not very elegant. I have to add com.abbyy.FREngine.jar into repository as following:
In that case my dependency in pom.xml looks like this:
In this configuration jar in repository has name like com.abbyy.FREngine.jar-11-win.jar, so unpackJarAndLoadFREngineJNIDll() method will work fine.
answered 10 Nov '15, 12:40
I had the same problem. I extracted the dll manually from the jar file and then copied the dll to C:\ProgramData\ABBYY\SDK\11\FineReader Engine\win\x64\
Note that you can copy the dll somewhere else and call Engine.SetJNIDllFolder(jniDllFolder) to set the parent folder of win\x64\FREngine.Jni.dll
answered 20 Nov '15, 19:18