title: JNA to call a DLL without source code from java
body: <p>I have to call a dll method and I don't have the source code from dll, I was reading about JNI and understood that you should have the source to input the JNI library in the code (.h). </p>
  
  <p>My second shoot is JNA, but I am getting the same error, although you don't have to change anything in DLL.</p>
  
  <p>I created two classes to test:</p>
  
  <p><strong>interface:</strong></p>
  
  <pre><code>package icom;
  
  import com.sun.jna.Library;
  
  public interface IConectorT extends Library {
      int StartConector(byte[] conectorStatus, String icomPath);
  }
  </code></pre>
  
  <p><strong>DLL method call:</strong></p>
  
  <pre><code>package icom;
  
  import com.sun.jna.Native;
  
  public class ConectorTJna {
  
      public static void main(String args[]) {
  
          IConectorT lib = (IConectorT) Native.loadLibrary("ConectorT", IConectorT.class);
          int teste = lib.StartConector(null, "C:\\ICOM");
          System.out.println("RESULT: " + teste);
      }
  }
  </code></pre>
  
  <p>When I call the <code>lib.StartConector</code> method I get this:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.UnsatisfiedLinkError: Error
    looking up function 'StartConector': The specified procedure could not
    be found.     at com.sun.jna.Function.(Function.java:179)   at
    com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:350)     at
    com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:330)     at
    com.sun.jna.Library$Handler.invoke(Library.java:203)  at
    $Proxy0.StartConector(Unknown Source)     at
    icom.ConectorTJna.main(ConectorTJna.java:10)</p>
  </blockquote>