Trying a simple hello program using C n Java. I get the Exception UnsatisfiedLinkError. What may be the reason for this? The dll file is in the same directory.
There are many possible reasons. One trivial one is that the DLL needs to be on the PATH, or named in the java.lib.path system property. Another is that you've named the native method incorrectly, or you haven't exported it from the DLL. Here is a simple step-by-step recipe for writing your first JNI program.
Went through the doc. Now how do i convert a c program to a dll. Uptil compilation of the c program all is fine. The java file is compiled and the header file generated.
I am using DevC++ 4.0. How do i name the dll in the java.lib.path??
Too many questions right but i m all muddled up n need help.
How to compile a C program as a DLL: You need to look that up in the documentation of your compiler (DevC++, as you say).
How to make sure the DLL is in the Java library path: Set the java.library.path system variable on the command line while starting your application, like this:
(Note: it's java.library.path, not java.lib.path as Ernest suggested). [ September 01, 2005: Message edited by: Jesper de Jong ]