Hi All, I am trying to do a "HelloWorld" program using JNI. The command "java HelloWorld" gives me:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/java_native/libhello.so: /tmp/java_native/libhello.so: only ET_DYN and ET_EXEC can be loaded
Relevant (.c .h and .java) files are attached. The stack trace and commands are in stack.txt.
The same code on a different machine (mekbuda) said: Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/java_native/libhello.so: /tmp/java_native/libhello.so: ELF file's phentsize not the expected size
Googling revealed a glibc related entry in bugzilla, but I dint find any other pointers:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=121606
Other information on the two machines follows: saayaa: $ uname -a Linux saayaa 2.6.5-1.358custom #2 Wed Aug 25 15:07:14 UTC 2004 i686 athlon i386 GNU/Linux
$ gcc --version gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
$ rpm -q glibc glibc-2.3.3-27
$ cat /etc/redhat-release Fedora Core release 2 (Tettnang)
mekbuda: $ uname -a Linux mekbuda 2.4.6-pre6-xfs #1 SMP Fri Jun 29 18:05:28 EDT 2001 i686 unknown
$ gcc --version 2.96
$ rpm -q glibc glibc-2.2.4-33
$ cat /etc/redhat-release Red Hat Linux release 7.1 (Seawolf)
Thanks for the assistance. Regards, SP
===== homepage - http://www.cse.buffalo.edu/~kompalli
__________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo
g++ -g -I/. -I/java/j2sdk1.4.2_05/include/ -I/java/j2sdk1.4.2_05/include/linux/ -c HelloWorld.c -o libhello.so
javac HelloWorld.java
java HelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/java_native/libhello.so: /tmp/java_native/libhello.so: only ET_DYN and ET_EXEC can be loaded at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:834) at HelloWorld.<clinit>(HelloWorld.java:5)