I just created a project that imports Tess4J
But as soon as I run it, it complains:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract':
libtesseract.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden
Native library (linux-x86-64/libtesseract.so) not found in resource path
the library is located at /usr/lib/x86_64-linux-gnu/libtesseract.so.5
. I tried creating a link from libtesseract.so, but nothing changed. Cannot create full link, as the error message does not give an absolute path.
my LD_LIBRARY_PATH
seems to be empty, odd. Followed down this rabbit hole to a Debian bug from 2009 that was finally solved in 2022. No idea why it’s not solved for me and if I should follow this further.
System.setProperty("jna.library.path", "/usr/lib/x86_64-linux-gnu/");
does not help either. Tried setting it in run config… nothing.
A solution I found told to set the path in eclipse library config, but you cannot edit this config when jars are pulled from maven repo by gradle. so you have to config the native path in gradle? how?
my build.gradle.kts
:
plugins {
`java-library`
}
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j
implementation("net.sourceforge.tess4j:tess4j:5.11.0")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
thank you very much