简体   繁体   English

仅当从eclipse和tomcat运行时,LoadLibrary才会失败

[英]LoadLibrary fails only when running from eclipse & tomcat

UnsatisfiedLinkError when trying to load Lingo library, on Linux 64 bit, in Java using 尝试使用Java在Linux 64位系统上加载Lingo库时出现UnsatisfiedLinkError

static{
    System.loadLibrary("lingojni64"); 
     }

After setting the LD_LIBRARY_PATH 设置LD_LIBRARY_PATH之后

export LD_LIBRARY_PATH=/home/utcn11/lingo14/bin/linux64
  • when running from command line works fine; 从命令行运行时工作正常;

  • when running from eclipse gives: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lingojni64 in java.library.path 从eclipse运行时给出:线程“主”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有lingojni64

Already tried setting 已经尝试设置

System.setProperty("java.library.path", "/home/utcn11/lingo14/bin/linux64"); 

But same error occurs 但是发生同样的错误

  • when running from eclipse after setting the 设置后从Eclipse运行时
    -Djava.library.path="/home/utcn11/lingo14/bin/linux64" The following error occurs: -Djava.library.path =“ / home / utcn11 / lingo14 / bin / linux64”发生以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/utcn11/lingo14/bin/linux64/liblingojni64.so.14.0: liblingo64.so.14: cannot open shared object file: No such file or directory 线程“主”中的异常java.lang.UnsatisfiedLinkError:/home/utcn11/lingo14/bin/linux64/liblingojni64.so.14.0:liblingo64.so.14:无法打开共享对象文件:没有这样的文件或目录

ls -l /home/utcn11/lingo14/bin/linux64

total 41084

lrwxrwxrwx 1 utcn11 utcn11       16 Sep 29 16:36 liblingo64.so -> liblingo64.so.14

lrwxrwxrwx 1 utcn11 utcn11       18 Sep 29 16:36 liblingo64.so.14 -> liblingo64.so.14.0

-rwxr-xr-x 1 utcn11 utcn11  2911124 Oct 15  2013 liblingo64.so.14.0

lrwxrwxrwx 1 utcn11 utcn11       19 Sep 29 16:36 liblingojni64.so -> liblingojni64.so.14

lrwxrwxrwx 1 utcn11 utcn11       21 Sep 29 16:36 liblingojni64.so.14 -> liblingojni64.so.14.0

-rwxr-xr-x 1 utcn11 utcn11    28809 Aug 22  2013 liblingojni64.so.14.0
  • same error occurs when running the webapp in tomcat 在tomcat中运行Webapp时发生相同的错误

If run the project from Eclipse you can follow the next steps: 如果从Eclipse运行项目,则可以执行以下步骤:

  1. Right click on the project. 右键单击该项目。
  2. Go to Run as -> Run Configurations... 转到运行方式->运行配置...
  3. Go to the Environment tab. 转到环境选项卡。
  4. Click on New to create a new environment variable. 单击“ 新建”以创建一个新的环境变量。
  5. Enter the name of the variable ( LD_LIBARY_PATH ) and its path. 输入变量的名称( LD_LIBARY_PATH )及其路径。
  6. Click OK , then Apply . 单击确定 ,然后单击应用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM