On 1 Oct 2005 10:30:29 -0700,
wrote:
> But still two quesions:
>
> For the compiling and linking:
> gcc -Wall -D_REENTRANT -I $JAVA_HOME/include -I
> $JAVA_HOME/include/linux -c invoke.cpp
> gcc -L $JAVA_HOME/jre/lib/i386/client invoke.o -lstdc++ -ljvm -lpthread
> -o invoke
>
> The parameters for gcc are really important. Without anyone of them,
> the JNI calling can not work. But How do I know which parameter I
> should choose?
>
> Question two:
> For the two libjvm.so,
> /usr/lib/jvm/java-1.4.2-sun-1.4.2.05/jre/lib/i386/client/libjvm.so
> /usr/lib/jvm/java-1.4.2-sun-1.4.2.05/jre/lib/i386/server/libjvm.so
>
> I was told by Gordon that I should set the ID_LIBRARY_PATH like this:
> /usr/lib/jvm/java-1.4.2-sun-1.4.2_05/jre/lib/i386/server
> /usr/lib/jvm/java-1.4.2-sun-1.4.2_05/jre/lib/i386
> But why?
There are two versions of libjvm.so, a server and a client version,
and you need to link against one of them. I can't say exactly what the
difference is (some optimization details I think), but you can check
the documentation for the java command line options -server and
-client.
At runtime there are additional dependencies on library files found in
$JAVA_HOME/jre/lib/i386 (common to both server and client). So at your
library path needs at least two directories, the server (or client),
and the common 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