Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

gettin an error "elf size phent size not the expected size"

843829Jun 8 2005 — edited Jun 8 2005
Iam not able to run the java program given in the developer's site as an example for native method.
the program name is Helloworld.java which uses "hello" as an external library.

Iam running this program on linux platform.

I've compiled this program with javac HelloWorld.java

The next step of creating the header file has also been done using the command

javah -jni HelloWorld

The next step of writing a C code has also been done and it has been named as "HelloWorldImp.c"

now i have compiled the HelloWorldImp.c by using the folowing command

gcc -c -fpic -I /root/j2sdk1.4.2_07/include -I /root/j2sdk1.4.2_07/include/linux HelloWorld.c -o libhello.so

The above command has been executed with the library path set correctly.

After completing the above steps successfully and trying to execute the java program I am getting an error as given below

Exception in thread "main" java.lang.UnsatisfiedLinkError: /root/j2sdk1.4.2_07/bin/libhello.so: /root/j2sdk1.4.2_07/bin/libhello.so: ELF file's phentsize not the expected size
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:6)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2005
Added on Jun 8 2005
1 comment
1,055 views