大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
我需要javah和android-ndk的帮助。JAVAH找不到类(android ndk)
我tryed生成H-文件我的本地方法,但JAVAH说类文件未找到。
我的目标类有绝对的名称$ PROJECT_DIRECTORY/的src/BT/nativeclient/BtnativeActivity.java,包含跟随代码:
package bt.nativeclient;
import android.app.Activity; import android.os.Bundle; import android.widget.TextView;
public class BtnativeActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText(stringFromJNI());
setContentView(tv);
}
public native String stringFromJNI();
static
{
System.loadLibrary(“hello-jni”);
}
}
我tryed开始JAVAH从如下pathes:
$(PROJECT_DIRECTORY)/bin$ javah -jni bt.nativeclient.BtnativeActivity
$(PROJECT_DIRECTORY)/jni$ javah -jni bt.nativeclient.BtnativeActivity
$(PROJECT_DIRECTORY)$ javah -jni bt.nativeclient.BtnativeActivity
我试着指定-classpath修改:
$PROJECT_DIRECTORY/src$ javah -classpath :. bt.nativeclient.BtnativeActivity
我tryed指定的android.jar提到:
$PROJECT_DIRECTORY/bin$ javah -classpath :/home/l/android-sdks/platforms/android-10/android.jar:. bt.nativeclient.BtnativeActivity
但我总是得到结果只有一个:
error: cannot access bt.nativeclient.BtnativeActivity
class file for bt.nativeclient.BtnativeActivity not found
javadoc: error – Class bt.nativeclient.BtnativeActivity not found.
Error: No classes were specified on the command line. Try -help.
而且,随着-verbose选项命令javah说,这个命令是seaching我的类它有效的地方:
$PROJECT_DIRECTORY/src$ javah **-verbose** -classpath :/home/l/android-sdks/platforms/android-10/android.jar:. bt.nativeclient.BtnativeActivity
error: cannot access bt.nativeclient.BtnativeActivity
class file for bt.nativeclient.BtnativeActivity not found
javadoc: error – Class bt.nativeclient.BtnativeActivity not found.
[ Search Path: /usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/netx.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/plugin.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/modules/jdk.boot.jar:/usr/lib/jvm/java-6-openjdk/jre/classes/:/home/l/android-sdks/platforms/android-10/android.jar:. ]
Error: No classes were specified on the command line. Try -help.
我觉得我失去了一些重要的东西,但我仍然无法找到解决方案。
请问有人可以帮我吗?
2012-04-02
Alex Wih
+0
不javac的命令的作品? –
2012-04-03 03:46:31
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/192893.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...