I have a builder C++ application that create a VM to process metadata from file. My application comunicate with my ExtractMetadata.jar with JNI.
When i test that with my IDE, it works fine(the process metadata works fine). But when i create my setup application and i run that the process metadata is not run fine.
I logged that and it seems the class is not found.
jclass cls;
jmethodID midAllfield, midConstructor, mid1;
jobject newObj;
jboolean isCopy;
FILE *FileMeta;
String strFields, strValueFields, strFld;
JavaVM* jvm;
JNIEnv* env;
// Attach this Thread to JVM
jint succGetJVM = gl_env->GetJavaVM(&jvm);
int succ1 = succGetJVM;
if(succGetJVM!=0)
logging(sExtractMetaLogFile, "\n GetJavaVM(&jvm) : failure ");
else {
logging(sExtractMetaLogFile, "\n GetJavaVM(&jvm) : Success :");
logging(sExtractMetaLogFile, IntToStr(succ1));
}
jint succAttchd = jvm->AttachCurrentThread((void**)&env, NULL);
int succ2 = succAttchd;
if(succAttchd!=0)
logging(sExtractMetaLogFile, "\n AttachCurrentThread : failure ");
else{
logging(sExtractMetaLogFile, "\n AttachCurrentThread : Success : ");
logging(sExtractMetaLogFile, IntToStr(succ2));
}
cls = (*env).FindClass("ExtractMetaData");
jthrowable exc = env->ExceptionOccurred();
if (exc) {
jclass newExcCls;
try {
env->ExceptionDescribe();
}
catch (...) {
ShowMessage("env->ExceptionDescribe()");
return;
}
logging(sExtractMetaLogFile, "\n ExceptionDescribe : ");
env->ExceptionClear();
}
if(cls !=0)
{
//....
}
else
{
logging(sExtractMetaLogFile, "\n Tika Thread Not Found class : ExtractMetaData ");
}
And my log result is
GetJavaVM(&jvm) : Success :0
AttachCurrentThread : Success :
ExceptionDescribe :
Tika Thread Not Found class : ExtractMetaData
Why it works fine when i start my application from my IDE and not work when run it from my installed application?!!
So answer:
open properties of shortcut and set field "Start in" to "C:\Program Files (x86)\xxx\bin\"