0

我有 vlc 便携式应用程序。在我的机器上。当我尝试使用此代码加载库时

    NativeLibrary.addSearchPath(
                  RuntimeUtil.getLibVlcLibraryName(), "C:/arun/software_Installations/VLC"
                );

Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);

它抛出异常:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:169)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:242)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:368)
at com.sun.jna.Native.loadLibrary(Native.java:353)
at guvi.VLCJ.main(VLCJ.java:18)
4

1 回答 1

0

首先,你应该尝试

System.load("C:\\Path\\Of\\libvlc.dll");

至少要验证您的库是否可以加载。如果没有,它可能会为您提供有用的错误消息。

然后,在您的VLC安装中搜索文件libvlc.dll和文件,并将它们的路径添加到您编写的代码中 。libvlccore.dllNativeLibrary.addSearchPath()

NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:/arun/software_Installations/VLC/"); // Make sure the "libvlc.dll" is present in this path.
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
LibXUtil.initialise();
于 2013-03-08T03:56:56.087 回答