无法使用javah -stubs生成JNI .c文件 [英] Unable to generate JNI .c file using javah -stubs

查看:50
本文介绍了无法使用javah -stubs生成JNI .c文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Java类生成JNI代码. 我能够使用javah毫无问题地生成标题 每当我使用-stubs命令运行javah时,都会出现此错误:

I am trying to generate JNI code from my Java class. I was able to generate the header without a problem using javah Whenever I run javah with the -stubs command I get this error:

错误:JNI不需要存根,请参阅JNI文档.

Error: JNI does not require stubs, please refer to the JNI documentation.

有人知道是否有一种方法可以为类生成JNI .c文件. 我可以手动从标题创建文件,但似乎工具应该可以完成此操作.

Does anyone know if there is a way to generate a JNI .c file for a class. I can make the file from my header by hand, but it seems like something a tool should be able to do.

我从2000年开始发现了有关此问题的未解决的错误请求,因此我不太抱有希望. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id= 4368114

I found an unresolved bug request about this from 2000 so I'm not too hopeful. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4368114

推荐答案

-stubs是JNI长期淘汰的第一批产品的遗留物.它从来没有产生任何对当前世纪使用的Java版本有用的东西.

-stubs is a leftover from a long-obsolete first cut at JNI. It never generated anything useful for any version of Java used in the current century.

只需将头文件复制到您的.c文件中,然后向每个函数添加一个函数主体即可.

Just copy the header file into your .c file and add a function body to each function.

或者可以看看 http://jna.java.net/.

这篇关于无法使用javah -stubs生成JNI .c文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆