1 Reply Latest reply on Nov 25, 2014 7:01 PM by jschellSomeoneStoleMyAlias

    How Can I load third party dll in another dll and used in java native interface


      I have one dll, I want to load that dll into java native interface but it was not working properly. so now i try to create new dll file and load existing dll into that new dll file and access method from existing dll . How Can i do this ??. Please help me.


      Following code which i write in .c file


        #include "stdafx.h"

        #include <basetyps.h>

        #include <jni.h>

        #include "HelloPopup.h"

        #include <windows.h>


      typedef int * (_stdcall * OPENCOM) (int ComPort);

      HINSTANCE dllHandle;

      int result;




      * Class: HelloPopup

      * Method: OpenSerialPort

      * Signature: (I)I

      */`enter code here`


      JNIEXPORT jint JNICALL Java_HelloPopup_OpenSerialPortDll

        (JNIEnv * env, jobject obj, jint ComPort)


        OPENCOM pOpenCom ;

        dllHandle=LoadLibrary ("AlzData.dll");

        POpenCom = (OPENCOM) GetProcAddress (dllHandle, "OpenSerialPort");

        int * ret = (* pOpenCom) (ComPort);


        FreeLibrary (dllHandle);


        return result;



      .. but when i call the method in java native interface i was got an error..So this code i am little bit confused about this code it is correct or not please help me.