The most common is jni,jnative (the package of your jar based on JNI)
Note: Java invokes the DLL, which must be handled in the DLL. Columns such as: Method name must be _java_ package Name _ Class Name _ Method name use JNI Invoke DLL step to create a new Java project, put DLL file under SRC Configuration Change Project environment JRE under native directory, point to SRC The project JDK must not be brought with Eclipse, using its own installed JDK path to create a new directory and class declaration in the directory order in the DLL in the same way as in a DLL, by adding the native keyword (note parameter type) to the code static block (do not suffix):
static {
system.loadlibrary ("Testdll");
}
Then write the main method to invoke the. If there is an error, pay attention to observe the error information, may be missing dependent DLL file
simple encapsulation Jni Simple Package a calling DLL class code can be shared in the resource, my code download the calling code (mainly static block code changed), Dllutil this piece of code in the share download
static {
try {
Dllutil.extractfromjar ("TestDll.dll", "TestDll.dll", System
. GetProperty (" Java.io.tmpdir "));
System.load (System.getproperty ("Java.io.tmpdir") + "\\testDll.dll");
SYSTEM.OUT.PRINTLN ("Load TestDll.dll success!!");
} catch (Exception e) {
System.out.println ("TestDll.dll error:" + e.getmessage ());
}