-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
7u181, 8u172, 8-pool
-
Cause Known
-
linux
example:
===
[dbuck@dbuck02 jni32]$ LD_LIBRARY_PATH=. /java/jdk1.8.0_172/bin/java HelloJNI
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /home/dbuck/jni32/libhello.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/dbuck/jni32/libhello.so: /home/dbuck/jni32/libhello.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at HelloJNI.<clinit>(HelloJNI.java:3)
[dbuck@dbuck02 jni32]$
===
The warning is really confusing and may distract from the real issue (loading a 32-bit library when you need to use a 64-bit one). We should see if there is some way to avoid it.
===
[dbuck@dbuck02 jni32]$ LD_LIBRARY_PATH=. /java/jdk1.8.0_172/bin/java HelloJNI
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /home/dbuck/jni32/libhello.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/dbuck/jni32/libhello.so: /home/dbuck/jni32/libhello.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at HelloJNI.<clinit>(HelloJNI.java:3)
[dbuck@dbuck02 jni32]$
===
The warning is really confusing and may distract from the real issue (loading a 32-bit library when you need to use a 64-bit one). We should see if there is some way to avoid it.