问题
I have 'libjep.so' file after downloading jep and I also had set the environmental variable LD_LIBRARY_PATH
in ~./bashrc
as shown below:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/python2.7/dist-packages/jep/libjep.so
as well as in runtime
System.load("/usr/local/lib/python2.7/dist-packages/jep/libjep.so");
But when I have the follwing line in my code,
Jep jep = new Jep();
It shows the below error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jep in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jep.Jep$TopInterpreter$1.run(Jep.java:118)
at java.lang.Thread.run(Thread.java:745)
Thanks
回答1:
You need to set the LD_LIBRARY_PATH to the directory containing your library, and not your library itself like this
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/python2.7/dist-packages/jep/
You can also try adding this argument to the java command when you start your java application so java can find the library
-Djava.library.path=/usr/local/lib/python2.7/dist-packages/jep/
回答2:
The java.lang.UnsatisfiedLinkError
occurs only when if the required library is not in the path or it is already loaded.
Couple of things you need to make sure is :
1) You're performing System.load(....)
inside static block so that its executed only once.
2) Also, you can try removing extension.
来源:https://stackoverflow.com/questions/38183062/exception-in-thread-main-java-lang-unsatisfiedlinkerror-no-jep-in-java-librar