无法生成头文件 [英] Can't generate Header File
问题描述
我已经.java文件
我想用javah -jni命令生成.h文件
例如我在E:\\中有HelloWorld.java
命令提示符
E:\ _javah -jni HelloWorld.java
我发现此错误
错误:无法访问HelloWorld.java
找不到HelloWorld.java的类文件
javadoc:error - 找不到类HelloWorld.java。
错误:命令行中未指定任何类。试试-help。
请帮帮我:confused:
I've already .java file
I want to generate .h file using javah -jni command
eg.I have HelloWorld.java in E:\
In Command Prompt
E:\javah -jni HelloWorld.java
I found this error
error: cannot access HelloWorld.java
class file for HelloWorld.java not found
javadoc: error - Class HelloWorld.java not found.
Error: No classes were specified on the command line. Try -help.
Please help me:confused:
推荐答案
当然它会给出错误因为你使用了错误的命令。
简而言之,您使用的是HelloWorld.java
,这是FileName而不是Class Name。
Of-course it will give error because you are using wrong command.
In short you are usingHelloWorld.java
which is FileName not Class Name.
E:\javah -jni HelloWorld.java //HelloWorld.java is name of JavaFile not ClassFile
基本上你需要知道实际语法
basically you need to know Actual Syntax which is
javah -jni ClassFile
你需要使用
you need to use
E:\javah -jni HelloWorld //if HelloWorld is your ClassFile.
希望它适合你。:)
我已经尝试过了。
我试试
在命令提示符下:
E:\ _javah -jni HelloWorld.class
我也一样错误
错误:无法访问test.class
找不到test.class的类文件
javadoc:错误 - 找不到类test.class。
错误:在命令行上没有指定类。试试-help。
帮助我:(
I've already tried.
I try
In Command prompt:
E:\javah -jni HelloWorld.class
I got the same error
error: cannot access test.class
class file for test.class not found
javadoc: error - Class test.class not found.
Error: No classes were specified on the command line. Try -help.
Help me :(
我浪费了3个小时。这是由于某种原因java目录问题或者是什么。无论如何这就是我做的。
打开命令行。转到.java类所在的确切文件夹。去那里执行命令
I wasted like 3 hours on this. It has been due to some sort of java directory issues or what. Anyways this is how i did it.
Open command line. Go to the exact folder where .java class is located. go there and execute command
javac HelloWorld.java
然后回到包含完整包的文件夹。输入这个语句用于从类文件生成头文件。该目录必须像我的情况一样整个包是用Java目录文件所以我回到那里并输入以下命令。
then go back to the folder containing the complete package. There type this statement for generating the header file from the class file. The directory must be like in my case the whole package was in Java directory file so i went back there and typed the following command.
javah -jni com.example.aliabbasjaffri.temporary.HelloWorld
Voila,您服务的头文件。
Voila, Header file at your service.
这篇关于无法生成头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!