当我运行以下命令在我的 JNI 项目中创建头文件时出现以下错误
root@bsd-pc1907:/home/sat/KISHORE/kishore workspace/Ivijni/bin/classes/com/ivi/jni# javah JniActivity
error: cannot access JniActivity
bad class file: RegularFileObject[./JniActivity.class]
class file contains wrong class: com.ivi.jni.JniActivity
Please remove or make sure it appears in the correct subdirectory of the classpath.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:180)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:159)
at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:95)
at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:188)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:364)
at com.sun.tools.javadoc.Start.begin(Start.java:162)
at com.sun.tools.javadoc.Main.execute(Main.java:113)
at com.sun.tools.javah.Main.main(Main.java:153)
javadoc: error - fatal error
2 errors
我的 JniActivity.java
public class JniActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
System.loadLibrary("hellojni");
new JniActivity().sayHello();
}
private native void sayHello();
}
hellojni.cpp
#include "hellojni.h"
#include <iostream>
using namespace std;
void sayHello () {
cout << "Hello World Again!" << endl;
return;
}
任何帮助总是很感激,谢谢