[英]Exception in thread “main” java.lang.UnsatisfiedLinkError: no jep in java.library.path
I have 'libjep.so' file after downloading jep and I also had set the environmental variable LD_LIBRARY_PATH
in ~./bashrc
as shown below: 下载jep后我有'libjep.so'文件,我也在
~./bashrc
设置了环境变量LD_LIBRARY_PATH
,如下所示:
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 谢谢
You need to set the LD_LIBRARY_PATH to the directory containing your library, and not your library itself like this 您需要将LD_LIBRARY_PATH设置为包含库的目录,而不是像这样的库本身
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 您还可以尝试在启动Java应用程序时将此参数添加到java命令,以便java可以找到该库
-Djava.library.path=/usr/local/lib/python2.7/dist-packages/jep/
The java.lang.UnsatisfiedLinkError
occurs only when if the required library is not in the path or it is already loaded. 仅当所需库不在路径中或已加载时,才会发生
java.lang.UnsatisfiedLinkError
。 Couple of things you need to make sure is : 您需要确定的一些事情是:
1) You're performing System.load(....)
inside static block so that its executed only once. 1)您在静态块内执行
System.load(....)
以便它只执行一次。
2) Also, you can try removing extension. 2)此外,您可以尝试删除扩展名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.