新手请教:java调用jar包
在Eclipse工程中设置build patch,add external archives,将需要的jar包添加到工程:
import net.sf.ffmpeg_java.AVFormatLibrary;
主函数中调用包,声明一个变量:
final AVFormatLibrary AVFORMAT = AVFormatLibrary.INSTANCE;
AVFORMAT.av_register_all();
编译后通过,运行时报错:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot locate library avformat-51
at com.sun.jna.NativeLibrary.<init>(NativeLibrary.java:73)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:94)
at com.sun.jna.Library$Handler.<init>(Library.java:104)
at com.sun.jna.Native.loadLibrary(Native.java:156)
at com.sun.jna.Native.loadLibrary(Native.java:139)
at net.sf.ffmpeg_java.AVFormatLibrary.<clinit>(AVFormatLibrary.java:18)
at AVcodeSample.main(AVcodeSample.java:38)
那位高手知道原因,帮忙解答一下。