UnSatisfiedLinkError -- Very Very Urgent...
Hi,
We are using a third party tool in our application. Our application has to call a function from the third party tool. The particular method is in a dll. We have been provided with the dll.
I tried loading the "dll" by using
1.System.loadLibrary("rlpolk");
and declared the native method.
2.private native void cvina(char inVin[],char outVIN[]);
3. Compiled the Java file
4. Created the header file by using javah.exe command
5. Created C file. I have written the function implementation in the C file.
When I try to compile the c file it throws a error " unable to find include file jni.h"
When I try to execute the java file I get UnSatisfiedLinkError: " Unable to find the method.
Please advise. Its very urgent.
Below is my program.
<CODE>
CallCvina.java
package Janci.CVINA;
public class CallCvina
{
static
{
System.setProperty("java.library.path","C:\\PCCVINA");
System.loadLibrary("rlpolk");
//System.load("C:\\PCCVINA\\rlpolk.dll");
}
String VIN=new String("1C4GP55R4VB238735");
char[] inVin =new char[34];
char[] outVIN=new char[1299];
private native void cvina(char inVin[],char outVIN[]);
public static void main(String args[])
{
CallCvina CC = new CallCvina();
CC.inVin=CC.VIN.toCharArray();
CC.outVIN[0]='\0';
try{
CC.cvina(CC.inVin,CC.outVIN);
}
catch (UnsatisfiedLinkError e)
{
System.err.println("Unable to find cvina function."+ e.getMessage());
}
}
CVINA.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class CallCvina */
#ifndef _Included_CallCvina
#define _Included_CallCvina
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class:CallCvina
* Method:cvina
* Signature: ([C[C)V
*/
JNIEXPORT void JNICALL Java_CallCvina_cvina
(JNIEnv *, jobject, jcharArray, jcharArray);
#ifdef __cplusplus
}
#endif
#endif
CVINA.c
#include <jni.h>
#include "CVINA.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_CallCvina_cvina(JNIEnv *env, jobject obj,jcharArray inVin[], jcharArray outVIN[])
{
printf("Call CVINA Method");
cvina(inVin,outVIN);
return;
}
</CODE>
Thanks,
Janci

