0

サンプル JNI プログラムを試していますが、javah ツールを動作させることができません。C:\Workspace\VideoRecorder\src\org\ccb\wifo\video\Nativejni.java に 1 つのソース ファイル、Nativejni.java があります。org.ccb.wifo.video はパッケージの名前です。コンパイルして、src ディレクトリにクラス ファイルを取得しました。ヘッダー ファイルを生成するために、以下のように試しました。

C:\Workaspace\VideoRecorder\bin>javah -jni org.ccb.wifo.video.Nativejni

しかし、のようなエラーが発生しました。

**error: cannot access org.ccb.wifo.video.Nativejni
class file for org.ccb.wifo.video.Nativejni not found
javadoc: error - Class org.ccb.wifo.video.Nativejni not found.
Error: No classes were specified on the command line.  Try -help.**

私はたくさんグーグルで検索し、そこで見つかった解決策を試しました。しかし、役に立たない。私を助けてください。

4

3 に答える 3

0

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

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, Header file at your service.

于 2014-07-02T08:33:15.760 に答える
0

それには多くの理由が考えられます。主に -classpath と関係があります。クラスパスを手動で変更したくない場合は、コンソールでコンパイル中に行うことができます。

javah -d /dir/where/output/generated -classpath ;<absolute path to the /bin/classes> <package name>

1)「;」を覚えておいてください あなたが提供したパスを既存のものに追加するので重要です。

2) スラッシュには注意してください (Linux = / および Windows では = )。

3) 絶対パスの意味を理解していると思います。

于 2013-02-05T13:58:17.447 に答える