I received the following error on the first attempt of using the User32.Instance:
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library;
at com.sun.jna.platform.win32.User32.(User32.java:48)
whilst trying to run a JNA pre-defined mapping of the Windows User32 class functions.
I tried running the following code:
HWND hwnd = User32.INSTANCE.FindWindow(null,"new 2 - Notepad++");
User32.INSTANCE.SetForegroundWindow(hwnd);
Do I have to declare my own Interface or am I able to use the User32 JNA mapping located in jna-platform? What am i doing wrong?
Edit: The error is on this line from the com.sun.jna.platform.win32.user32:
User32 INSTANCE = Native.load("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);