Skip to main content

Doesn't found the method inside dll (JNA)

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2012-09-25

I have a dll called "EnigmaEncriptacionwith.dll" with the following structure.

namespace EnigmaEncriptacion
    public static class Encriptador
        // Nested Types
        public static class Jan7Encriptador
            // Methods
             public static string Encriptar(string textoQueEncriptaremos, string key);


But I can not call the method Encriptar, inside DLL. Here is my java code.

import com.sun.jna.Library;
import com.sun.jna.Native;

public class CallDLLMethod {

public interface EnigmaEncriptacion extends Library {
    public String Encriptar(String a, String b);

public static void main(String[] args) {
EnigmaEncriptacion lib = (EnigmaEncriptacion) Native.loadLibrary("EnigmaEncriptacion", EnigmaEncriptacion.class);
        lib.Encriptar("a", "b");

The exception thrown

Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Encriptar': The specified procedure could not be found.
at com.sun.jna.Function.(
at com.sun.jna.NativeLibrary.getFunction(
at com.sun.jna.NativeLibrary.getFunction(
at com.sun.jna.Library$Handler.invoke(
at $Proxy0.Encriptar(Unknown Source)
at CallDLLMethod.main(

I think this is the structure of the DLL, the method Encrypt (String, String) is not within the class Encriptador, is within the class Jan7Encriptador which is within the class Encriptador.

I searched on the subject but found nothing about it, can anyone help?

Thanks ^^