Hey i am trying to use tess4j for tesseract and having this issue for eclipse on mac osx .
My tesseract is working fine from terminal but trying to run tess4j throug
I had a very similar issue with Ghost4j, i.e.
InvocationTargetException: Unable to load library 'gs': Native library (darwin/libgs.dylib) not found in resource path
Instead of modifying jar files, point jna to the appropriate lib path by setting jna.library.path
. In Eclipse, you need to set the system property in run configurations - SO answer for this here - https://stackoverflow.com/a/862405/2163229
If you're using Maven exec:
mvn -Djna.library.path=/opt/local/lib/ exec:java -Dexec.mainClass="foo.bar.NativeThingy"
or
export MAVEN_OPTS="-Djna.library.path=/opt/local/lib/" && mvn exec:java -Dexec.mainClass="foo.bar.NativeThingy"
Obviously, set the path to wherever your libs are installed. In my case, I ran $ locate libgs.dylib
and found the above path.
References: https://jna.java.net/javadoc/com/sun/jna/NativeLibrary.html