I have been trying to make jsmile work (libjsmile.so) in a web application with Apache Tomcat 7 on a Linux CentOS 7 server using all the methods I could find on the Internet, but I still haven't succeeded.
I was able to use this wrapper (libjsmile.jnilib downloaded on Nov. 24, 2014) as a Java application or a web application with Apache Tomcat 7 on a Mac (with jdk 1.6). And I was able to load libjsmile.so as a Java application on the CentOS 7 server (with jre 1.8). The error starts to occur when I want to load libjsmile.so in a web application with Apache Tomcat 7 in the CentOS 7 (with jre 1.8). I have tried to add LD_LIBRARY_PATH (and/or JAVA_OPTS="-Djava.library.path=.....") to the Tomcat configuration file (tomcat.conf) with the path that I put the libjsmile.so inside (e.g./usr/share/java/tomcat/lib). Here is the error:
java.lang.UnsatisfiedLinkError: smile.Wrapper.nativeStaticInit()V
smile.Wrapper.nativeStaticInit(Native Method)
smile.Wrapper.<clinit>(Wrapper.java:59)
I have tried using System.loadLibrary() in Wrapper.java or used System.load() with an absolute path:
Code: Select all
package smile;
public abstract class Wrapper
{
public Wrapper()
{
ptrNative = createNative(null);
}
public Wrapper(Object param)
{
ptrNative = createNative(param);
}
public void dispose()
{
deleteNative(ptrNative);
ptrNative = 0;
}
protected void finalize()
{
deleteNative(ptrNative);
}
protected abstract long createNative(Object param);
protected abstract void deleteNative(long nativePtr);
private static native void nativeStaticInit();
protected long ptrNative = 0;
static
{
System.loadLibrary("jsmile");
nativeStaticInit();
}
}
I am not that experienced in web development and Linux, and am feeling very helpless now. I couldn't find any instructions from the website and forum (sorry if I missed them). Could you give me some step-by-step instructions? Any help is deeply appreciated!
Thanks,
Yun
ISP, UPitt