Reputation: 121780
This is a question which puzzles me. javah
needs a classpath, of bytecode-compiled classes, in order to generate its headers.
But there is javac
which, presumably, builds an AST out of the source code, which could possibly be used by javah
as well. Especially since native methods are easily spotted.
So, why does javah
need the bytecode at all?
Upvotes: 2
Views: 404
Reputation: 81704
Just because that's how they wrote it. I agree, it absolutely could have been written to operate on source, but that's not what they did.
The somewhat interesting thing about the way it is written is that you can use it if you have source (by compiling it first) or if you don't have source; that means the way it's done is actually more flexible, not less.
Upvotes: 5