免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1690 | 回复: 3
打印 上一主题 下一主题

关于jni的问题告急啊。。。。。。。。。。。。。。。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-06-18 20:58 |只看该作者 |倒序浏览
package test;
public class  SayHello1
{
    public SayHello1()
    {
    }
    public native void greet();
    public native void see();
    static
    {
        System.load("c:\\dlltest\\sayhello1.dll";
    }
/***********************************************/
import test.SayHello1;
public class TestGet
{
        public static void main(String[] args)
        {
                SayHello1 temp= new SayHello1();
                temp.greet();
                temp.see();
        }
}
编译时没有问题,但是运行时报如下错误:
java.lang.UnsatisfiedLinkError: greet
去掉程序SayHello1中的包头package test 程序运行正常,觉得是加了包头后就引入不了dll文件了,不知道这问题怎么解决,我希望能在SayHello1
中加上package test

谢谢帮忙看看

论坛徽章:
0
2 [报告]
发表于 2003-06-19 17:04 |只看该作者

关于jni的问题告急啊。。。。。。。。。。。。。。。。。

我也发现同样的问题,如果加了包名,就会发生UnsatisfiedLinkError。你如果解决了,可得把方法共享一下,哪位高手出来发表一下高见。

论坛徽章:
0
3 [报告]
发表于 2003-06-19 17:28 |只看该作者

关于jni的问题告急啊。。。。。。。。。。。。。。。。。

this may help you:

http://groups.yahoo.com/group/java-linux/message/10974


and alway search your problem on google first
may there were lot's of answer!!

论坛徽章:
0
4 [报告]
发表于 2003-06-19 17:42 |只看该作者

关于jni的问题告急啊。。。。。。。。。。。。。。。。。

Got it!!

The name of the native entry point is derived from the full
package+class+method name. If you rerun javah on your classfile, you'll
see it's now expecting a different name for the native function.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP