【发布时间】:2014-11-27 11:37:36
【问题描述】:
我正在开发一个使用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)
我不知道发生了什么。
【问题讨论】:
-
欢迎使用 StackOverflow。请提供一些代码(最好是 SSCCE)。
标签: java dll java-native-interface spotify