Posted By:
Anonymous
Posted On:
Wednesday, January 24, 2007 11:57 PM
Hi all... I am new to JNI and I've been surviving through error messages so far by searching solutions in the internet. But this time I can't solve the problem. Please help me.... error message: class JvFollowLineMain { public static void main(String[] args) { JvFollowLine jfl = new JvFollowLine(); jfl.doFollowLine(args); } } class JvFollowLine { public native void doFollowLine(String[] args); static { System.loadLibrary("JvFollowLineImp"); } } #include "JvFollowLine.h" #if !MONITOR #include
More>>
Hi all...
I am new to JNI and I've been surviving through error messages so far by searching solutions in the internet. But this time I can't solve the problem. Please help me....
error message:
class JvFollowLineMain {
public static void main(String[] args) {
JvFollowLine jfl = new JvFollowLine();
jfl.doFollowLine(args);
}
}
class JvFollowLine {
public native void doFollowLine(String[] args);
static {
System.loadLibrary("JvFollowLineImp");
}
}
#include "JvFollowLine.h"
#if !MONITOR
#include
#else
#include
#endif
#include
#include
using namespace VXV;
JNIEXPORT void JNICALL Java_JvFollowLine_doFollowLine (JNIEnv *env, jobject obj, jobjectArray args) {
// Getting argc and argv
jsize argc = env->GetArrayLength(args);
char *argv[128];
for(int i = 0; i
jstring thObj = (jstring)env->GetObjectArrayElement(args, i);
char *thStr = (char*)env->GetStringUTFChars(thObj, 0);
argv[i] = thStr;
}
// Displaying the arguments (argc and argv)
for(int i = 0; i
< argc; i++) printf("argc = %i; argv[%i] = %s
", argc, i, argv[i]);
try {
#if !MONITOR
RunCtrl run;
#else
mRunCtrl run;
vmonitor::show();
#endif
if (run.connect(argc, argv)
< 0) {
printf("RunCtrl::connect: %s
", run.what());
exit(1);
}
// Move forward for 3 second
run.followLine(Position(0, 0, deg(0)));
VXV::Delay(3000);
run.stop();
VXV::Delay(1000);
} catch (std::exception& e) {
printf("exception: %s
", e.what());
}
return;
}
BTW: this program is to move a mobile robot forward for 3 second
Thank you....
<<Less