Re: Under Linux, Call java from C++



On 30 Sep 2005 08:59:19 -0700, tony_lincoln@xxxxxxxxx wrote:
> You are right. My java version is 1.4.2_05.
> So I changed the codes into
> vm_args.version = JNI_VERSION_1_4_2_05;
>
> But the error kept the same:
>
> rakta:~/GAQ$ gcc -Wall -D_REENTRANT -I
> /home/gao/java/j2sdk1.4.2_08/include -I
> /home/gao/java/j2sdk1.4.2_08/include/linux-c invokeLinux.cpp
> invokeLinux.cpp: In function `int main()':
> invokeLinux.cpp:24: error: `JNI_VERSION_1_4_2_05' undeclared (first use
> this
> function)
> invokeLinux.cpp:24: error: (Each undeclared identifier is reported only
> once
> for each function it appears in.)

The only valid values are (AFAIK) JNI_VERSION_1_4, JNI_VERSION_1_2 and
JNI_VERSION_1_1, they are listed in jni.h.

The paths you mention in the example above don't agree with what
you've posted elsewhere, where you mentioned
/usr/lib/jvm/java-1.4.2-sun-1.4.2_05.

It seems you have several java versions installed. You need to make
sure you compile and link against the correct (and same) one.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
.



Relevant Pages

  • Re: Under Linux, Call java from C++
    ... My java version is 1.4.2_05. ... So I changed the codes into ... invokeLinux.cpp: In function `int main': ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: JNI, call java from C++.
    ... > know that this error is caused by CallStaticVoidMethod() in C++ ... > codes. ... First, mainalways returns int, never void. ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: Matrix - Transformation
    ... public class CODES ... private double x; ... public int BoardNumber ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "delete" causes prog to crash!
    ... > class codes ... > int returnCode() const; ... > int alarmCode; ... >>> I assign the pointer an address, ...
    (microsoft.public.vc.language)
  • Re: Segmentation violation due to MEX code
    ... Anyway, the codes to compare are a little different to what you posted, since I changed something that drastically increased the C performance. ... void mexFunction(int nlhs, mxArray *plhs, ... Elapsed time is 0.599098 seconds. ...
    (comp.soft-sys.matlab)