java使用jni调用一个NativeTest.dll,这个NativeTest.dll集成了图像优化处理的这么一个ocr.dll和图像识别代码,
在NativeTest.DLL里面调用ocr.DLL的函数的时候就出现这么一个错误:如下,恳请大侠们帮忙拉,解决马上结贴给分,不够分数可以再加。------------------------------------------------------------------------
Fatal Java Exception detected at Wed Sep 03 13:30:55 2008
------------------------------------------------------------------------
Please follow these steps in reporting this problem to The MathWorks so
that we have the best chance of correcting it: 1. Send us this crash report. For your convenience, this information
has been recorded in: C:\DOCUME~1\user\LOCALS~1\Temp\java.log.2864 2. Provide a brief description of what you were doing when this
problem occurred. 3. If possible, include M-files, MEX-files, or MDL-files that aid
in reproducing it. 4. E-mail or FAX this information to us at:
E-mail: [email protected]
FAX: 508-647-7201Thank you for your assistance.
在NativeTest.DLL里面调用ocr.DLL的函数的时候就出现这么一个错误:如下,恳请大侠们帮忙拉,解决马上结贴给分,不够分数可以再加。------------------------------------------------------------------------
Fatal Java Exception detected at Wed Sep 03 13:30:55 2008
------------------------------------------------------------------------
Please follow these steps in reporting this problem to The MathWorks so
that we have the best chance of correcting it: 1. Send us this crash report. For your convenience, this information
has been recorded in: C:\DOCUME~1\user\LOCALS~1\Temp\java.log.2864 2. Provide a brief description of what you were doing when this
problem occurred. 3. If possible, include M-files, MEX-files, or MDL-files that aid
in reproducing it. 4. E-mail or FAX this information to us at:
E-mail: [email protected]
FAX: 508-647-7201Thank you for your assistance.
public class CESHI {
public CESHI() {
// System.out.println(System.getProperty("java.library.path"));
System.loadLibrary("NativeTest");//这里是最后封装的DLL供JAVA应用程序调用
}
public native String ocrimage(String name);//NativeTest.DLL的函数 public static void main(String[] args) {
CESHI test = new CESHI();
String str = "K:\\CESHI\\DSC04769.JPG";
String ResultStr = test.ocrimage(str); //NativeTest.DLL函数的调用,也是问题出现在这里
System.out.println("the result of the application is" +ResultStr); }
}//NativeTest.DLL代码:CString ocrimage(CString name);
#pragma comment(lib,"OCRDLL") //调用OCR.DLL,提供ocrimage方法处理JNIEXPORT jstring JNICALL Java_CESHI_ocrimage
(JNIEnv *env, jobject jobj, jstring str){
AfxMessageBox(env-> GetStringUTFChars(str,false));//这一步程序可以正确获得
CString CSjs=ocrimage(env->GetStringUTFChars(str,false)); //执行到这里就出错了!!!后面不执行
//ocrimage是OCR.DLL里面的一个方法 AfxMessageBox("2");
jstring js;
char *cCSjs;
cCSjs=CSjs.GetBuffer(0);
AfxMessageBox("3");
js=convertANSIToUNI(env,cCSjs);
AfxMessageBox("4");
return js;
}
OCR库是为了处理图像(有窗体的,不知道dos能不能调用有窗体的dll呢)