Cannot load shared library from Java on AIX

I am working on a 64-bit AIX5.2 machine. I created a hello world program using JNI. When I run it, System.loadLibrary() does not find my shared library. After looking into it for several hours, I realized it might be something to do with my 32 bit mode build. The reason I am building as 32 bit is because I thought it would work on both 32 and 64 bit platforms.

This is how I compile my C++ file and build the shared library:

xlC_r -brtl -q32 -c -I"." -I"/usr/java5_64/include" -c NativeHello.cpp -o NativeHello.o

xlC_r -brtl -G -q32 -o libNativeHello.so NativeHello.o

When I run my HelloWorld java program, it gives this error:

java.lang.UnsatisfiedLinkError: NativeHello (A file or directory in the path name does not exist.)

However, when I change the build lines to use -q64 instead of -q32, my hello world program works just fine.

So I am suspecting that Java is not expecting my shared library that was compiled as 32 bit.

How can I correct this problem? Is there any flag that I might be missing? Or do I need to build separate libraries for 32 bit and 64 bit environment?

Thanks for your help in advance.

[1176 byte] By [cactuara] at [2007-11-27 8:20:35]
# 1

This is not a java problem.

It is a VM problem.

So for the VM (vendor and version) that you are using it requires certain things.

It might be that the VM doesn't load 32 at all. Or that you have to do something different when you compile it.

A forum that is specific to your VM might be more productive (this site tends to be strongly solaris/linux/windows.)

jschella at 2007-7-12 20:08:55 > top of Java-index,Java HotSpot Virtual Machine,Specifications...