Hey,
Am Dienstag, den 02.05.2017, 22:20 -0700 schrieb Vishwajit:
> On Tuesday, May 2, 2017 at 10:01:43 PM UTC+5:30, Matthias Bläsing wrote:
> > Am Dienstag, den 02.05.2017, 07:01 -0700 schrieb Vishwajit:
> > > I am getting below Exception while accessing Windows 7 Native
> > library.
> > >
> > > Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'win64': Native library (win32-x86-64/win64.dll) not found in resource path ([file:/C:/Users/o2petp/workspace/Practice/bin/, file:/C:/Users/o2petp/workspace/Practice/lib/gson-2.7.jar, file:/C:/Users/o2petp/workspace/Practice/lib/jna-platform-4.4.0.jar, file:/C:/Users/o2petp/workspace/Practice/lib/jna-4.4.0.jar])
> > > at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303)
> > > at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427)
> > > at com.sun.jna.Library$Handler.<init>(Library.java:179)
> > > at com.sun.jna.Native.loadLibrary(Native.java:569)
> > > at download.wallpaper.WallpaperDownloader$User32.<clinit>(WallpaperDownloader.java:47)
> > > at download.wallpaper.WallpaperDownloader.main(WallpaperDownloader.java:43)
>
>
> > > line 47 User32 INSTANCE = (User32) Native.loadLibrary("win64", User32.class, W32APIOptions.DEFAULT_OPTIONS);
You are calling this Variant of the loadLibrary function:
public static <T> T loadLibrary(String name, Class<T> interfaceClass, Map<String, ?> options) {
From the documentation:
* @param name Library base name
* @param interfaceClass The implementation wrapper interface
* @param options Map of library options
So you ask JNA to load a library with the name "win64" by definition
this means on windows the library must reside in win64.dll and that
can't be found.
According to:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
the function
SystemParametersInfo
resides in:
DLL: User32.dll
So you want:
User32 INSTANCE = Native.loadLibrary("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);
Greetings
Matthias