I am trying to execute a dll through JNI.
I have 32 bit dll and 64 bit dll
My code works fine in a 32 bit machine(using 32 bit dll).
but it doesnt work on a 64 bit machine. I tried executing it with both 32 bit and 64 bit dll.
I also tried installing 64 bit JDK,JRE and tried to run the 64 bit dll through java.
I am getting the following error.
# A fatal error has been detected by the Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006d451528, pid=956, ti
# JRE version: 6.0_21-b07
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0-b17 mixed mode windows-amd64
# Problematic frame:
# C [java.dll+0x1528]
# An error report file with more information is saved as:
# C:\Program Files\Java\jdk1.6.0_21\bin\hs_err_pid956.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
Any idea what could be the problem.
"amd64" is just the name for the instruction set used by all consumer 64-bit Intel processors, because AMD were the first to define it, and Intel later had to play catch-up.
You need to use a 32-bit library with a 32-bit JVM, and a 64-bit library with a 64-bit JVM. If you're getting an access violation, then there's a bug in the native code. If the bug only shows up in the 64-bit version and not the 32-bit, then you're probably just lucky that it works on 32-bit. The hs_err crash report might give you a hint where the problem occurs, or it might not.
"The native code" refers to the C language code that's in the DLL itself -- i.e., the implementation of Java_myJNIClass_myNativeEx().
I don't know what you mean by "the exe version" -- how would you test the JNI code without the JVM? If there's some underlying functionality which you tested in C and that works fine, that's great -- but it's the JNI wrapper code that I'm more concerned about.
I have the same problem with a 3rd party dll. The DLL is loaded successfully under a 32-bit machine. But under 64-bit the jvm crashes. I have tested on both 32-bit && 64-bit JVMs. Any suggestions?