Cannot load native library. Error: java.lang.UnsatisfiedLinkError
I am having trouble getting Java开发者_如何学运维 to see the file 'libvensim.so' that I have in my home directory.
I have tried setting LD_LIBRARY PATH...."echo $LD_LIBRARY_PATH" returns "./libvensim.so"
When I run the code:
java -cp ./vensim.jar:. -Djava.library.path=./libvensim.so Test
I get the error "Cannot load native library. Error: java.lang.UnsatisfiedLinkError: no libvensim in java.library.path".
Test.java is a simple class to test whether I can access the .so:
import com.vensim.Vensim;
public class Test {
public static void main(String[] args) throws Exception {
Vensim vensim = new Vensim("libvensim");
}
}
Can anyone see my problem? Thanks very much.
LD_LIBRARY_PATH
should point to the directory containing the .so
files. Try:
java -cp ./vensim.jar:. -Djava.library.path=. Test
or
export LD_LIBRARY_PATH=/path/to/dir
java -cp ./vensim.jar:. Test
精彩评论