英文:
Vlcj jna unsatisfied link error unable to locate native libraries
问题
我已经看过了这些链接:
这是我的系统规格:
-
Windows 64位
-
Java 11 64位
-
Vlc 32位
这是我的代码:
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:Program Files (x86)\\VideoLAN\\VLC");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
这是我的错误信息:
java.lang.UnsatisfiedLinkError: 无法加载库 'libvlc':在资源路径中找不到JNA本机支持(win32-amd64/libvlc.dll)(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)
我知道你不应该在64位的JRE中加载32位的VLC库,这就是为什么我不指望这个程序能正常工作(或者也许它会,我不确定),但错误消息应该是不同的,类似于以IA32开头之类的,但情况并非如此。正如你所看到的,尽管使用了NativeLibrary类添加了搜索路径,但Native类似乎仍在jar文件和项目路径中搜索dll文件,而不是在我明确指定的搜索路径中查找,所以我的Native甚至无法找到dll文件。
有人能提供帮助吗?
英文:
I have already seen the links
These are my system specs
-
Windows 64bit
-
Java 11 64 bit
-
Vlc 32 bit
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?
答案1
得分: 0
我用3个步骤解决了我的问题:
1)使用从第一个评论中的链接提供的本机发现方法,因为NativeLibrary.addSearchPath
没有起作用,所以我删除了那行代码,并用以下代码代替:
new NativeDiscovery().discover();
2)使用了64位的vlc。
3)"主要修复"是将我的JDK从11降级到1.8,由于某种原因,版本号在3.5及以上的vlcj无法与我最新的JDK一起使用,我无法理解其中的原因,但恰恰是这个主要更改使得NativeDiscovery能够正常工作。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论