Trying to generate C header using javah

508 Views Asked by At

About a year ago I started work on a Java project which required a native C library. I used javah to generate the header file and then wrote the library. This was all done in Windows 7.

Now I'm trying to revisit the project and add to the native library, I've modified the java, saved the project and exported creating a new jar file.

I wrote a batch file to generate the C header file, however this is the problem, it no longer works and I'm not sure why or how to resolve the error. My batch file, 'mkhdr.bat' contains:

"D:\Program Files\Java\jdk1.7.0_25\bin\javah" cantley.co.uk.clsMain

The path to javah is correct and the batch file is run from the root of the project which resides in eclipse workspace.

But when I try to run this I get:

Error: Could not find class file for 'cantley.co.uk.clsMain'.

I've tried adapting the javah call including -classpath but nothing works. The project folder contains the following:

|-.settings (eclipse settings)
|-cantley (top folder of my package)
| |-co
|    |-uk
|       |-clsMain.java (all the java files as well as class files)
|-libsr (my native library build and source files)
|-.classpath (eclipse classpath configuration xml)
|-.project (eclipse project xml)
|-flipmngr (my eclipse project configuration)
|-flipmngr.jar (my exported jar)
|-mkhdr.bat (batch file to produce native C header file)

Thank you,

0

There are 0 best solutions below