3

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!

Felix
  • 3,783
  • 5
  • 34
  • 53
  • 1
    The code I have uses '{Install Path}/VideoLAN/VLC` (ie `C:/Program Files (x86)/VideoLAN/VLC`, but I also look for `libvlc.dll` and `libvlcore.dll` within the that folder to be sure – MadProgrammer Dec 20 '12 at 00:10
  • @MadProgrammer that worked! Thanks very much :) If you want to chuck that comment in an answer I'll accept it. – Felix Dec 20 '12 at 01:22

2 Answers2

3

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

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

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
1

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"

Petro Semeniuk
  • 6,970
  • 10
  • 42
  • 65