Somous_
Somous_
采纳率14.3%
2017-03-01 06:58 阅读 1.9k

linux下使用JNA调用libopencv_java2413.so报错

5

(。so放在linux/user/lib下,环境变量已配好)
测试代码
import com.sun.jna.Library;

import com.sun.jna.Native;

public class Main1 {

public interface Clibrary extends Library {  

    Clibrary INSTANTCE = (Clibrary) Native.loadLibrary("opencv_java2413",  
            Clibrary.class);  


    long n_eye(int rows, int cols, int type);  

}  

public static void main(String[] args) {  

    System.out.println(Clibrary.INSTANTCE.n_eye(3, 3, 2));   
}  

}

linux命令:
java -cp /home/jna.jar:/home Main1

报错信息

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'opencv_java2413': libavcodec.so.54: cannot open shared object file: No such f
ile or directory

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)

at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)

at com.sun.jna.Library$Handler.(Library.java:140)

at com.sun.jna.Native.loadLibrary(Native.java:374)

at com.sun.jna.Native.loadLibrary(Native.java:359)

at Main1$Clibrary.(Main1.java:9)

at Main1.main(Main1.java:19)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • zqbnqsdsmd zqbnqsdsmd 2017-03-01 22:36
  • shellcenter shellcenter 2019-06-04 19:13

    请问 库:libopencv_java2413.so,是你自己编的还是从网上下载的?我需要一个这样的库,不知道怎么获取?大侠,看见帮忙回答一下,十分感谢!!!

    点赞 评论 复制链接分享

相关推荐