The gcc command that is used to compile the native code doesn't account for the fact that we might be running a 32-bit JVM on a 64-bit OS. Consequently we need to compile for 32-bits otherwise we will get a runtime failure:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.so: /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
Also note that this native code causes the following VM warning:
Java HotSpot(TM) Embedded Server VM warning: You have loaded library /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.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: /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.so: /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
Also note that this native code causes the following VM warning:
Java HotSpot(TM) Embedded Server VM warning: You have loaded library /export/local/aurora/CommonData/jtreg_8/JT_HS/test/runtime/jsig/libTestJNI.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'.