下载此文档

eclipse下jni初试.doc


文档分类:通信/电子 | 页数:约2页 举报非法文档有奖
1/2
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/2 下载此文档
文档列表 文档介绍
2007-06-1210:53JNI=javanativeinterface,为java应用程序提供调用本地方法的接口    ThestandardJavaclasslibrarymaynotsupporttheplatform-dependentfeaturesneededbyyourapplication.   essibletoJavaapplications.   Youmaywanttoimplementasmallportionoftime-criticalcodeinalower-levelprogramminglanguage,suchasassembly,andthenhaveyourJavaapplicationcallthesefunctions 步骤: jni;public class HelloWorld {    static{        ("hellodll");    }    public native void dispHelloWorld();    /**     * ***@param args     */    public static void main(String[]args) {        // TODOAuto-generatedmethodstub        //("abc");        new HelloWorld().dispHelloWorld();    }}2,保存后如果没有错误eclipse会编译产生jni/,假设工程产生的class都在classes文件夹下(这个文件夹名字跟个人eclipse设置有关,也可能就是工程根目录),那么控制台cd到classes用javah命令产生h文件,XXX/classes>javah-(package不要漏掉),/* DONOTEDITTHISFILE-itismachinegenerated */#include <>/* Headerforclassjni_HelloWorld */#ifndef_Included_jni_HelloWorld#define _Included_jni_HelloWorld#ifdef__cplusplusextern "C" {#endif/* *Class:     jni_HelloWorld *Method:    dispHelloWorld *Signature:()V */JNIEXPORT void JNICALLJava_jni_HelloWorld_dispHelloWorld  (JNIEnv *,jobject);#ifdef__cplusplus}#endif#endif4,写cpp,,这里请注意函数名,cpp里的函数名跟h文件的函数名要一致,如果是

eclipse下jni初试 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数2
  • 收藏数0 收藏
  • 顶次数0
  • 上传人zbfc1172
  • 文件大小67 KB
  • 时间2019-03-29