我正在开发一个使用libjahspotify的应用程序。该程序在我的桌面(Windows 7)上运行,尝试在我的笔记本电脑(Windows 8.1)或我的其他英特尔NUC(Windows 7)上运行时出现以下错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\temp\jahspotify.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at jahspotify.JahSpotifyNativeLoader.<init>(JahSpotifyNativeLoader.java:90)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:438)
at jahspotify.impl.JahSpotifyImpl.<clinit>(JahSpotifyImpl.java:730)
at jahspotify.services.JahSpotifyService.initialize(JahSpotifyService.java:56)
at jahspotify.services.JahSpotifyService.getInstance(JahSpotifyService.java:26)
at jahspotify.services.JahSpotifyService.initialize(JahSpotifyService.java:39)
at net.functionseven.divicantus.spotify.Spotify.init(Spotify.java:29)
at net.functionseven.divicantus.Divicantus.main(Divicantus.java:20)
libjahspotify中的native-jar应该自动加载dll,但不会。此时似乎没有加载jahspotify.dll。如果我手动将jahspotify.dll复制到文件夹,native-jar将删除它,就像它应该的那样。
我已多次重新编译libjahspotify,并多次检查java和dll都是x86。我还试图用System.load()手动加载它,我得到类似的错误,如下所示。
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: C:\temp\jahspotify.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at net.functionseven.divicantus.Divicantus.main(Divicantus.java:24)
我对正在发生的事情感到茫然。
答案 0 :(得分:1)
最可能的原因是第二个系统缺少jahspotify.dll所需的一些dll。您可以使用Dependency Walker(http://www.dependencywalker.com/)检查哪些dll是必需的,并尝试将它们与jahspotify.dll一起手动放置。通常缺少的DLL来自c ++可再发行包等。