简体   繁体   English

生成Java头文件时出错

[英]error generating java header file

I am trying to create a java header file. 我正在尝试创建一个Java头文件。 I compiled the project in netbeans then in command line i type the following: 我在netbeans中编译了项目,然后在命令行中输入了以下内容:

javah -classpath C:\Users\User\Documents\NetBeansProjects\JNITest\build\classes.jnitest HelloWorld

I also tried: 我也尝试过:

javah -classpath C:\Users\User\Documents\NetBeansProjects\JNITest\build\classes\jnitest HelloWorld

But I am getting an error: Could not find clas file for HelloWorld . 但是我遇到一个错误:找不到HelloWorld clas文件。

The class is clearly there located in: 该类显然位于以下位置:

C:\Users\User\Documents\NetBeansProjects\JNITest\build\classes\jnitest\HelloWorld.class

How should I correctly specify the path? 我应该如何正确指定路径?

Try this: 尝试这个:

javah -classpath C:\Users\User\Documents\NetBeansProjects\JNITest\build\classes jnitest.HelloWorld
                 ^---------------- class folder ------------------------------^ ^--- classname --^

Hoi, 海,

Oracle has a good tutorial about this: Javah - Tutorial Oracle对此提供了很好的教程: Javah-教程

The catch is to specify the full qualified class name correctly. 要注意的是正确指定完整的合格类名称 I guess you have set a package for your HelloWorld class, so that package must be within the path too. 我想您已经为HelloWorld类设置了一个程序包,因此该程序包也必须位于路径内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM