java VLCJ tutorial java.lang.UnsatisfiedLinkError

不问归期 提交于 2021-02-07 20:16:54

问题


I'm trying to use VLCJ, and got stuck on their first tutorial.

Here's my code:

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);
    }
}

Here's the output and exception I get:

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)

I made sure I'm using a 32 bit jdk and a 32 bit version of VLC.

Any ideas? Thanks in advance!


回答1:


Try using {Install Path}/VideoLAN/VLC (ie C:/Program Files (x86)/VideoLAN/VLC) instead.

I look for libvlc.dll and libvlcore.dll within the that folder to be sure that the libraries are installed, but that's just me ;)




回答2:


Try to use double backward slash in path:

"C:\\Program Files (x86)\\VideoLAN\\VLC\\sdk\\lib"

instead of:

"C:/Program Files (x86)/VideoLAN/VLC/sdk/lib"



来源:https://stackoverflow.com/questions/13963171/java-vlcj-tutorial-java-lang-unsatisfiedlinkerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!