Java 代码:
package nativeCaller;
public class call_dll {
static
{
System.load("netCashierDll");
}
public native void helloWord();
}
我的工程目录在 E:\Users\chen-bo\workspace\netCash_Software
通过DOS命令进入 cd E:\Users\chen-bo\workspace\netCash_Software\src\nativeCaller文件夹 编译xx.java
E:\Users\chen-bo\workspace\netCash_Software\src\nativeCaller>javac call_dll.java
返回包的上一级目录 编译生成.h文件
E:\Users\chen-bo\workspace\netCash_Software\src\nativeCaller>cd ..
E:\Users\chen-bo\workspace\netCash_Software\src>javah -jni nativeCaller.call_dll
头文件代码:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class nativeCaller_call_dll */
#ifndef _Included_nativeCaller_call_dll
#define _Included_nativeCaller_call_dll
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: nativeCaller_call_dll
* Method: helloWord
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_nativeCaller_call_1dll_helloWord
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
--------------------- 作者:bai_yechuang 来源:CSDN 原文:https://blog.csdn.net/bai_yechuang/article/details/9626059?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!