0

I'm trying out a sample JNI program but am unable to get the javah tool to work. I have 1 source file, Nativejni.java in C:\Workspace\VideoRecorder\src\org\ccb\wifo\video\Nativejni.java. org.ccb.wifo.video is the name of the package.I have compiled and got a class file in the src directory.And for generating header file I have tried like below

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

But I got an error like .

**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.**

I have googled a lot and tried the solutions found there. But no use. Please help me.

user987362
  • 377
  • 1
  • 5
  • 21

3 Answers3

0

There could be a lot of reasons for it. Mainly to do with -classpath. If you don't want to fiddle around with changing of classpath manually, you can do it while compiling in the console.

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

1) Remember that ";" is important as it appends the path provided by you to the already existing one.

2) Be careful with slashes (Linux = / and for Windows = ).

3)I suppose you understand what I mean by absolute path.

dsh
  • 12,037
  • 3
  • 33
  • 51
Amit Ahire
  • 303
  • 4
  • 10
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.

Ali Abbas Jaffri
  • 153
  • 2
  • 15
0

You have to enter classpath, Please try this,

 Javah - jni -classpath C:\Workspace\VideoRecorder\src\  org.ccb.wifo.video.Nativejni
ylmzekrm1223
  • 103
  • 5
  • 15