I have seen many posting this issue in SO. I have gone through those posts and tried out the suggested methods, but unfortunately could not help me resolve the issue.
Here is my problem:
public class runme {
static {
System.loadLibrary("example");
}
public static void main(String argv[]) {
System.out.println(example.fact(4));
}
}
Error:
anu@anu-desktop:~/Desktop/swigtest/new$ java runme
Exception in thread "main" java.lang.UnsatisfiedLinkError: no example in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at runme.<clinit>(runme.java:5)
Could not find the main class: runme. Program will exit.
The example library is in the same path as the runme.java. Why do I get this error then? I am working from Ubuntu OS.
Any help which would help me resolve this is much appreciated.
EDIT:
I have attached my files here
Even though the docs say that The manner in which a library name is mapped to the actual system library is system dependent, in my experience
loadLibrary‘s relative path refers to the working directory (after which it checks all other defined and system-dependent paths).If unsure about the working directory, check what
System.getProperty("user.dir")returns.