Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError: no lept in java.library.path #256

Closed
pigzee opened this issue Jul 25, 2016 · 8 comments
Closed

java.lang.UnsatisfiedLinkError: no lept in java.library.path #256

pigzee opened this issue Jul 25, 2016 · 8 comments
Labels

Comments

@pigzee
Copy link

pigzee commented Jul 25, 2016

my mac is ok, but linux can't run. thank you very much!
my ide is idea intellij.

linux error

my linux doesn't install leptonica,tesseract.
Got unchecked and undeclared exception which called by 172.21.0.76. service: ***.ImageService, method: ***, exception: java.lang.UnsatisfiedLinkError: no jnilept in java.library.path,
java.lang.UnsatisfiedLinkError: no jnilept in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
at org.bytedeco.javacpp.Loader.load(Loader.java:492)
at org.bytedeco.javacpp.Loader.load(Loader.java:409)
at org.bytedeco.javacpp.lept.(lept.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.bytedeco.javacpp.Loader.load(Loader.java:464)
at org.bytedeco.javacpp.Loader.load(Loader.java:409)
at org.bytedeco.javacpp.tesseract$TessBaseAPI.(tesseract.java:3648)
......
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsatisfiedLinkError: no lept in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
at org.bytedeco.javacpp.Loader.load(Loader.java:483)
... 41 more
a:1088)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
at org.bytedeco.javacpp.Loader.load(Loader.java:483)

... 41 more

linux version

uname -a
Linux app02 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


my pom.xml

run "mvn package" to get project package

<properties>
    <os.classifier>linux-x86_64</os.classifier>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>              
        <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>
......
<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>tesseract</artifactId>
    <version>3.04.01-1.2</version>
</dependency>
<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>tesseract</artifactId>
    <version>3.04.01-1.2</version>
    <classifier>${os.classifier}</classifier>
</dependency>
<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>leptonica</artifactId>
    <version>1.73-1.2</version>
    <classifier>${os.classifier}</classifier>
</dependency>

@saudet
Copy link
Member

saudet commented Jul 25, 2016

What happens if you try to run the sample code at
https://github.com/bytedeco/javacpp-presets/tree/master/tesseract#sample-usage ?

@pigzee
Copy link
Author

pigzee commented Jul 26, 2016

i run the sample code ,but the error is same with above.
remve os.classifier from pom.xml, only left

<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>     
        <artifactId>tesseract</artifactId>
    <version>3.04.01-1.2</version>
</dependency>

linux console shows error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnilept in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
        at java.lang.Runtime.loadLibrary0(Runtime.java:849)
        at java.lang.System.loadLibrary(System.java:1088)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
        at org.bytedeco.javacpp.Loader.load(Loader.java:492)
        at org.bytedeco.javacpp.Loader.load(Loader.java:409)
        at org.bytedeco.javacpp.lept.<clinit>(lept.java:10)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:274)
        at org.bytedeco.javacpp.Loader.load(Loader.java:464)
        at org.bytedeco.javacpp.Loader.load(Loader.java:409)
        at org.bytedeco.javacpp.tesseract$TessBaseAPI.<clinit>(tesseract.java:3648)
        at com.***.main.BasicTesseractExampleTest.main(BasicTesseractExampleTest.java:14)
Caused by: java.lang.UnsatisfiedLinkError: no lept in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
        at java.lang.Runtime.loadLibrary0(Runtime.java:849)
        at java.lang.System.loadLibrary(System.java:1088)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
        at org.bytedeco.javacpp.Loader.load(Loader.java:483)
        ... 8 more

@pigzee
Copy link
Author

pigzee commented Jul 26, 2016

can javacpp-presets run in centos?

@saudet
Copy link
Member

saudet commented Jul 26, 2016

CentOS 6 or 7, yes, 5, no

@pigzee
Copy link
Author

pigzee commented Jul 27, 2016

i solved the problem.
first, copy leptonica-1.73-1.2-linux-x86_64.jar and tesseract-3.04.01-1.2-linux-x86_64.jar to lib of your project in linux.
second, install gclib2.14 and gcc-4.8.0 in your linux, if your version is low.
it is ok.

but i don't know why that two jars can't build into package.

@saudet
Copy link
Member

saudet commented Jul 27, 2016

So, issues with the Maven plugin for Intellij. Make sure to let JetBrains know about that. I'm pretty sure It has nothing to do with glibc or gcc, or they would show up as errors in the exceptions above.

@saudet saudet closed this as completed Jul 27, 2016
@pigzee
Copy link
Author

pigzee commented Jul 27, 2016

thanks !

@brittfitch
Copy link

Adding that I encountered the same issue. Built & ran on mac in eclipse IDE fine. Same error on linux. It looks like the build on mac and execute on linux only included the jars for mac for lept & tess. Grabbing the cpp bin.zip and replacing the mac jars with the linux ones solve the problem.

To the earlier point, I also installed gcc but I don't think this had any effect here. Though likely would have if I had built it on linux originally instead of building on mac and copying to a linux box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants