Good afternoon, I work with JNA connected via the interface to the .dll library, but when I call it, the method writes

Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'connect': The specified procedure was not found.

but it is there is an entry in the library itself

function Connect(ChannelName: BSTR; Flags: I4; Username: BSTR; Password: BSTR): I4; stdcall; 

Here is my working code

  public static void main(String[] args) throws InterruptedException, IOException { ClientW ClientW = (ClientW) Native.loadLibrary("spn", ClientW.class); System.out.println("connect = " +ClientW.Сonnect(nuberChanell,SPR_CHANNEL_HARDNAME,null,null)); } public interface ClientW extends Library { int Connect(int flags, java.lang.String username, java.lang.String password); } 

What doesn't he like?

  • Capitalized: C onnect? - Pavel Parshin
  • @PavelParshin tried the same thing. - Varg Sieg

1 answer 1

This means that Java cannot load the library. This may be due to the fact that:

  • The library is not in the search paths.
  • The library is incorrectly named.
  • You do not have permission to access this library.
  • 32-bit library on 64-bit system
  • JRE is not configured
  • The library requires another, which you do not have
  • DLL is not compiled as JNI or used as JNA
  • The library is not in the search paths for how it didn’t put it in the root, then it gave this Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'spn': Native library (win32-x86 / spn.dll) not found in resource path then wrote something else - Varg Sieg
  • The library is incorrectly named. Do you mean this name "spn"? - Varg Sieg
  • You do not have permission to access this library. I work under the admin - Varg Sieg
  • The 32-bit library on the 64-bit system is not working in 32x - Varg Sieg
  • JRE is not configured this how? - Varg Sieg