I have problem when loading shared libraries (JNI) from java class on Ubuntu operator system
Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/ETcpsdk/lib/linux-x86_64/libjcryptoki.so: libcryptoki.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at tutorialjni.Test.<clinit>(Test.java:7)
- Test.java
package tutorialjni;
public class Test {
// Load an external library, called "jcryptoki"
static {
System.loadLibrary("jcryptoki");
}
public static void main(String[] args) {
System.out.println(System.getProperty("java.library.path"));
}
}
- LD_LIBRARY_PATH was allocated in /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/opt/jdk1.7.0_75"
LD_LIBRARY_PATH="/opt/ETcpsdk/lib/linux-x86_64:/opt/ETcpsdk/lib/"
And I own ETcpsdk folder.
libcryptoki.so put in /opt/ETcpsdk/lib/linux-x86_64/libcryptoki.so
Run file libcryptoki.so command
libjcryptoki.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
- JDK version:
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
- Ubuntu:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
I added library directory to ldconfig cache
Can you help me?