Community

java.lang.UnsatisfiedLinkError when trying to run Linux FineReader Engine Hello World sample Answered

Hello --

I am getting the following error when I try to run the Linux Java Hello World sample on CentOS 7:

[admin@localhost Hello]$ sudo ./run.sh
Initializing Engine...
Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/ABBYY/FREngine12/Bin/libFREngine.Jni.so: libPortLayer.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.abbyy.FREngine.Engine.loadFREngineJNIDllFromFolder(Engine.java:237)
at com.abbyy.FREngine.Engine.loadFREngineJNIDll(Engine.java:187)
at com.abbyy.FREngine.Engine.GetEngineObject(Engine.java:28)
at Hello.loadEngine(Hello.java:41)
at Hello.Run(Hello.java:29)
at Hello.main(Hello.java:21)

These are the steps I've taken to build/run the application:

cd /opt/ABBYY/FREngine12/Samples/Java/Hello
export LD_LIBRARY_PATH="/opt/ABBYY/FREngine12/Bin"
export JDK="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64"
export PATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64:$PATH

sudo ./build.sh
sudo ./run.sh

What's strange is that there is indeed a libPortLayer.so file in the same directory as libFREngine.Jni.so. Both files are located here:

/opt/ABBYY/FREngine12/Bin

Any ideas on what's wrong?

0

Comments

3 comments

  • Avatar
    Koen de Leijer

    Hi

    My idea is that you are running the shell-scripts as root (with sudo),
    but are not exporting the environment-variables as root.

    Best regards
    Koen de Leijer

    0
  • Avatar
    Jeff Boller

    That was it -- thank you so much!

    1
  • Avatar
    ThomasEOsborn

    I was also facing the same problem and I can't find its solution. I have also posted this question in another forum but still can't get a reply from there. Then I asked my friend to help me out with this problem and he shared your post with me. I am also running the shell-script as root.  But now I know my problem solution. Thank you Koen de Leijer.

    0

Please sign in to leave a comment.