javah 生产头文件问题解决 亲自试验,费了2天时间就解决这个问题

详细记录:

在eclipse中新建android 项目名称testJni 

新建一个类

package com.example.testjni;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class testdll
{
static
{
System.loadLibrary("goodluck");
}
public native static int get();
public native static void set(int i);
public static void main(String[] args)
{
testdll test = new testdll();
test.set(10);
System.out.print(test.get());
}
}

编译一下 项目上面右键--运行方式 -- Android Application 

 

自动在 C:\Documents and Settings\Administrator\workspace\testJni\bin\classes\com\example\testjni  目录下面生成class文件   testdll.class

 

运行cmd 进入

C:\Documents and Settings\Administrator\workspace\testJni\bin\classes>javah -jni -classpath . com.example.testjni.testdll

成功在classes文件夹下生成 com_example_testjni_testdll.h

 

费了2 天时间 终于成功

posted @ 2014-01-02 10:54  爱编程hao123  阅读(151)  评论(0编辑  收藏  举报