编程语言
首页 > 编程语言> > java VLCJ教程java.lang.UnsatisfiedLinkError

java VLCJ教程java.lang.UnsatisfiedLinkError

作者:互联网

我正在尝试使用VLCJ,并且卡在他们的first tutorial上.

这是我的代码:

package vlcj.tutorial1;

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;

public class Tutorial1A
{
    public static void main(String[] args)
    {
        // Ensure we're using the 32bit jdk.
        System.out.println("jdk version:  " + System.getProperty("sun.arch.data.model") + " bits.");

        NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:/Program Files (x86)/VideoLAN/VLC/sdk/lib");
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
    }
}

这是我得到的输出和异常:

jdk version:  32 bits.
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 vlcj.tutorial1.Tutorial1A.main(Tutorial1A.java:17)

我确定我使用的是32位jdk和32位版本的VLC.

有任何想法吗?提前致谢!

解决方法:

请尝试使用{安装路径} / VideoLAN / VLC(即C:/ Program Files(x86)/ VideoLAN / VLC).

我在该文件夹中查找libvlc.dll和libvlcore.dll以确保安装了库,但这只是我;)

标签:vlcj,java,unsatisfiedlinkerror
来源: https://codeday.me/bug/20190826/1724798.html