Search code examples
javajnavlcj

Vlcj jna unsatisfied link error unable to locate native libraries


I have already seen the links

  1. Link 1

  2. Link 2

  3. Link 3

These are my system specs

  1. Windows 64bit

  2. Java 11 64 bit

  3. Vlc 32 bit

  4. vlcj 3.5.0 downloaded with maven

This is my code

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

And This Is My Error

java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': JNA native support (win32-amd64/libvlc.dll) not found in resource path (C:\Program Files\Java\Vlcj\jna-3.5.2.jar;C:\Program Files\Java\Vlcj\platform-3.5.2.jar;C:\Users\Home\Documents\NetBeansProjects\JDK Examples\Chat Application\Tests\build\classes)

Now i know you shoudn't be loading VLC 32 bit libraries using an 64 bit JRE and that's why i don't expect this program to work(or maybe it will i don't know) but the error message would have been diffrent something starting like IA32 or similar but that's not the case , as you can see despite adding the search path using NativeLibrary class the Native class seems to be searching for the dll's in the jar files & in my project path but not in the search path i have explictly mentioned so my Native can't even locate the dll files.

Help anyone?


Solution

  • I solved my problem in 3 steps

    1)Using Native discovery which was suggested from the link in the first comment because NativeLibrary.addSearchPath didn't do anything so i removed that line and replaced it with

    new NativeDiscovery().discover();
    

    2)Using vlc 64 bit

    2)The "Main fix" was downgrading my JDK from 11 to 1.8 for some reason vlcj 3.5 and above won't work with my latest JDK and i can't understand it but it was this main change that allowed NativeDiscovery to work