Hi All , I have been trying to find a solution for loading an ActiveX component dll thru JNI and executing one of its functions. I have created a dll and wrote a simple funtion in it. Using System.load() method i loaded the same dll in da memory. But i am not able to make any native calls . Please could anyone suggest me any alternative to this. Please find the code pasted below.
Program Output :
Loaded !! Exception in thread "main" java.lang.UnsatisfiedLinkError: printMessage at scjp.TestNullVector.printMessage(Native Method) at scjp.TestNullVector.main(TestNullVector.java:23)
UnsatisfiedLinkError means the DLL cannot be found. You are passing the complete path to the DLL in your System.load() call. This is incorrect. One only passes the name of the library. The path to the library must be set in the OS environment (PATH in Windows, LD_LIBRARY_PATH in Linux). Have a look at the example in the Java Tutorial for more on correctly using JNI.
Doesn't the fact it didn't throw when doing load() mean that it DID find the DLL? Is the problem not in fact the use of load() not loadLibrary(). As I understand it, load() just loads the DLL into memory. If you want it to automatically link the DLL to native methods, you need loadLibrary(), I think.
By the way, what's this "in da memory" about? Please use real words (see JavaRanch guidelines). [ March 26, 2007: Message edited by: Peter Chase ]
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.