Discussion Locked

Error in creating JVM

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've got following error message while compiling the C program (which will create a JVM). I have already include the path of the jni.h and jni_md.h during compilation.

Does anyone know the causes of such error and how to solve it?

/tmp/cc3QW6IQ.o: In function `main':
/tmp/cc3QW6IQ.o(.text+0x16): undefined reference to `JNI_GetDefaultJavaVMInitArgs'
/tmp/cc3QW6IQ.o(.text+0x55): undefined reference to `JNI_CreateJavaVM'
collect2: ld returned 1 exit status

Thanks

5 replies

by gavin taylor

This is a link problem: you are not linking against the shared library that includes the JNI functions.

You don't say what OS you're on, but for Solaris, the library is libjvm.so (look for it under the jre directory tree of your java installation).

HTH.

This discussion is closed to new replies.