Not able to access a function in DLL file
Dear All,
Thanks in advance for your help. I am trying to access third party DLL file from Java first time. After going through the JNI tutorial I have done the following steps,
1. Created a Java file with 'native'functions, which are available in DLL file
public class WhereNetCOMApi
{
static
{
System.load("C:\\WNAPi\\WNOMApi");
}
public native int wNOpen (String hostname, String username, String password, Object session_id);
public native int wNSubscribe (Object session_id,String events_subscription);
}
2. Trying to call the Java function from my main function
public class WhereNetTest
{
public static void main(String arg[])
{
String sSessionID = "50005";
WhereNetCOMApi obj = new WhereNetCOMApi();
int iOpen = obj.wNOpen("","admin","admin","sSessionID");
System.out.println("Open Result : " + iOpen);
}
}
Error:
I am getting UnsatisfiedLinkError mentioning the function name. it seems to be the DLL file has been loaded, but it could not find the method.
Can any one help me to solve this issue.
Thanks & Regards,
Jose
[1203 byte] By [
josemecha] at [2007-11-26 21:51:16]

# 1
> Dear All,
>
> Thanks in advance for your help. I am trying to
> access third party DLL file from Java first time.
> After going through the JNI tutorial I have done the
> following steps,
>
> 1. Created a Java file with 'native'functions, which
> are available in DLL file
>
> public class WhereNetCOMApi
> {
> static
> {
>System.load("C:\\WNAPi\\WNOMApi");
> }
>
> public native int wNOpen (String hostname, String
> g username, String password, Object session_id);
> public native int wNSubscribe (Object
> t session_id,String events_subscription);
> }
>
> 2. Trying to call the Java function from my main
> function
>
> public class WhereNetTest
> {
> public static void main(String arg[])
> {
> String sSessionID = "50005";
> WhereNetCOMApi obj = new WhereNetCOMApi();
> int iOpen =
> = obj.wNOpen("","admin","admin","sSessionID");
>
> System.out.println("Open Result : " + iOpen);
> }
> }
>
> Error:
> I am getting UnsatisfiedLinkError mentioning the
> function name. it seems to be the DLL file has been
> loaded, but it could not find the method.
Is this DLL file specifically for JNI? If yes, post the actual stack trace for the error.