JNI problem on Linux

G

Guest

I'm having some problems with using Java/JNI from a C++ program (actually
all C, just compiled as C++ with .cpp extension).

Using this JVM shared library:
/usr/java/jdk1.3.1_03/jre/lib/i386/server/libjvm.so - had to use the server
because if I use the client, I get the unresolved symbol "jdk_sem_post".
Read somewhere on the net that I should use the server version instead of
classic.

I am able to resolve to libjvm.so and the symbol JNI_CreateJavaVM, but when
I call to create my VM, I get the following messages in my callback routine.

Error occurred during initialization of VM
Unable to load native library
libjvm.so: cannot open shared object file: No such file or directory

ldd libjvm.so shows the following:
libnsl.so.1 => /lib/libnsl.so.1 (0x404fc000)
libdl.so.2 => /lib/libdl.so.2 (0x40513000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40516000)
libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2
(0x4052c000)
libm.so.6 => /lib/libm.so.6 (0x4056e000)
libc.so.6 => /lib/libc.so.6 (0x4058e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

A strings libjvm.so shows only the above .so files and also libhpi.so, which
is apparently the native or green threads version. I tried adding the
location of native_threads/libhpi.so to LD_LIBRARY_PATH and still no help.

My linus is a fairly old RedHat.
A uname shows "Linux linus 2.2.16-22 #11 SMP Tue Oct 2 18:02:55 EDT 2001
i686 unknown"

I link with "-lm -ldl -lbsd -lpthread"

The same code works OK on Win2K and also on Solaris 8.
I have standalone Java only code which is able to do JNDI and JMS with no
problem on this machine.

Thanks for any help - kinda baffled.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top