java生成本地头文件用javah出错问题

View Code
 1  proxytest]# javah ObjectTransmitter
 2 错误:无法访问 ObjectTransmitter
 3 错误的类文件: ./ObjectTransmitter.class
 4 类文件包含错误的类: com.zuishiming.proxytest.ObjectTransmitter
 5 请删除该文件或确保该文件位于正确的类路径子目录中。
 6 com.sun.tools.javac.util.Abort
 7     at com.sun.tools.javac.comp.Check.completionError(Check.java:164)
 8     at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
 9     at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:77)
10     at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:159)
11     at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
12     at com.sun.tools.javadoc.Start.begin(Start.java:128)
13     at com.sun.tools.javadoc.Main.execute(Main.java:66)
14     at com.sun.tools.javah.Main.main(Main.java:147)

出现错误的原因在于,编译头文件的类是在com.zuishiming.proxytest.ObjectTransmitter里,ObjectTransmitter前面的是包名称,不能在shell里作为当前目录执行javah ObjectTransmitter;假设当前项目名称为:SimpleTest,在/root/workspace/下,包的名称是com.zuishiming.proxytest在/root/workspace/SimpleTest/src,那么生成头文件的正确做法是:

1、cd /root/workspace/SimpleTest/src;

2、javah ObjectTransmitte。这样就能正确生成了。

============聊以备忘

posted @ 2013-01-24 19:09  草原战狼  阅读(972)  评论(0编辑  收藏  举报
草原战狼淘宝小店

No one indebted for others,while many people don't know how to cherish others.

No one indebted for others,while many people don't know how to cherish others.

Don‘t cry because it is over, smile because it happened.

Don‘t try so hard, the best things come when you least expect them to.