0

I'm very new to JNI, and trying to write a HelloWorld program using the tutorial given here and on giving the command as

javah HelloWorld or javah -classpath <classpath> HelloWorld for different values

for eg. javah -classpath /home/my_myfolder -o HelloWorld.h example.jni.HelloWorld

but I am getting

 error: cannot access HelloWorld
 class file for HelloWorld not found
 javadoc : error -Class HelloWorld not found
 Error : No classes were specified on the command line.

I have already tried all the answers listed here but none have worked for me. If you could be a little specific with what to specify as my classpath, I'd be grateful. Assume my code HelloWorld.java is in /home/my_folder, as is the HelloWorld.class file.

UPDATE -- Okay, so the problem was solved, and it wasn't the classpath at all, but the example program given in the link that I used was itself faulty.

There is an extra HelloWorld obj = new HelloWorld(); required in the sample code., in the main() function.

Community
  • 1
  • 1
triya.chd
  • 13
  • 5

1 Answers1

0

The argument to javah is a complete class name including the package name, same as for the java command. See the tool documentation.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
user207421
  • 305,947
  • 44
  • 307
  • 483
  • 1
    You should really provide examples, or at least a link to the tool docs. – Nathaniel Ford Jun 25 '13 at 20:51
  • If the downvote is supposed to convey that the answer isn't useful as it stands, I disagree, and I also disagree with @NathanielFord that an example is needed of something as some as a complete class name. – user207421 Jun 25 '13 at 21:04
  • upvote, because EJP is correct and google is a tool to use in such a case. – sschrass Jun 25 '13 at 21:21
  • @NathanielFord It is certainly not imprecise in any way. It is a precise and concise statement of the facts, and the imputation of laziness is both irrelevant and offensive. – user207421 Jun 25 '13 at 21:37
  • I apologize if I have given offense; I am not implying you're lazy, but that the answer is. I think this is relevant because it speaks directly to the quality of answers on S.O. You are of a different opinion, and that's fine; that is why the vote mechanism is in place. – Nathaniel Ford Jun 25 '13 at 21:55