13

I've just wasted 2 hours trying to do something which I've already done twice before. I can't remember the exact procedure I used the previous two times, but it really shouldn't be giving me this much trouble:

I have a project folder called "BoardGUIv3". I want to produce a header file based on a class called "CANController", with the source located in "BoardGUIv3/src/model" and the class file in "BoardGUIv3/bin/model".

I've done exactly this thing before, but for some reason I can't seem to do this simple, one-line command again.

I'm pretty sure it's something along the lines of

javah -classpath <classpath> src/model/CANController

My classpath should just be the root directory, shouldn't it?

Tagc
  • 8,736
  • 7
  • 61
  • 114

1 Answers1

13

Here is the javah command usage:

{javahLocation} -o {outputFile} -classpath {classpath} {importName}

and it should be used like this for you class:

javah -o "CANController.h" -classpath "C:\pathToYourProjDir\BoardGUIv3\bin" model.CANController

Just correct the path to your classfile with the real path and the package structure if required.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
  • I tried the exact command you wrote from within the root directory (BoardGUIv3). I got the following error: Could not find class file for 'model.CANController' – Tagc Sep 09 '13 at 17:03
  • have u given the complete path to your class file as classpath? – Juned Ahsan Sep 09 '13 at 17:04
  • classpath should contain bin directory path – Juned Ahsan Sep 09 '13 at 17:05
  • I gave the absolute directory: "javah -o "CANController.h" -classpath "C:\Users\\workspace\BoardGUIv3\bin\model" model.CANController – Tagc Sep 09 '13 at 17:07
  • 2
    remove model from classpath it should be -classpath "C:\Users\\workspace\BoardGUIv3\bin" – Juned Ahsan Sep 09 '13 at 17:08
  • This is not working in my laptop.`sudo javah -o "BNreGpioNpsdk.h" -classpath "/npsdk/niagara_dev_home/samples/npsdkJni/npsdkJni-rt/bin" com.tridium.nre.BNreGpioNpsdk` – prem30488 Oct 17 '18 at 05:28
  • Error: Could not find class file for 'com.tridium.nre.BNreGpioNpsdk'. – prem30488 Oct 17 '18 at 05:34