You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

javah.html 4.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Javah Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="javah">Javah</a></h2>
  8. <h3>Description</h3>
  9. <p>Generates JNI headers from a Java class.</p>
  10. <p> When this task executes, it will generate the C header and source files that
  11. are needed to implement native methods. JNI operates differently depending on
  12. whether <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javah.html">JDK1.2</a>
  13. (or later) or <a href="http://java.sun.com/products/jdk/1.1/docs/tooldocs/win32/javah.html">pre-JDK1.2</a>
  14. systems are used.</p>
  15. <h3>Parameters</h3>
  16. <table border="1" cellpadding="2" cellspacing="0">
  17. <tr>
  18. <td valign="top"><b>Attribute</b></td>
  19. <td valign="top"><b>Description</b></td>
  20. <td valign="top" align="center"><b>Required</b></td>
  21. </tr>
  22. <tr>
  23. <td valign="top">class</td>
  24. <td valign="top">the fully-qualified name of the class (or classes,
  25. separated by commas)</td>
  26. <td align="center" valign="top">Yes</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">outputFile</td>
  30. <td valign="top">concatenates the resulting header or source files for all the classes listed into this file</td>
  31. <td align="center" valign="middle" rowspan="2">Yes</td>
  32. </tr>
  33. <tr>
  34. <td valign="top">destdir</td>
  35. <td valign="top">sets the directory where javah saves the header files or the
  36. stub files.</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">force</td>
  40. <td valign="top">specifies that output files should always be written (JDK1.2 only)</td>
  41. <td valign="top" align="center">No</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">old</td>
  45. <td valign="top">specifies that old JDK1.0-style header files should be generated
  46. (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)</td>
  47. <td valign="top" align="center">No</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">stubs</td>
  51. <td valign="top">generate C declarations from the Java object file (used with old)</td>
  52. <td valign="top" align="center">No</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">verbose</td>
  56. <td valign="top">causes Javah to print a message concerning the status of the generated files</td>
  57. <td valign="top" align="center">No</td>
  58. </tr>
  59. <tr>
  60. <td valign="top">classpath</td>
  61. <td valign="top">the classpath to use.</td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">bootclasspath</td>
  66. <td valign="top">location of bootstrap class files.</td>
  67. <td valign="top" align="center">No</td>
  68. </tr>
  69. <tr>
  70. <td valign="top">extdirs</td>
  71. <td valign="top"> location of installed extensions.</td>
  72. <td valign="top" align="center">No</td>
  73. </tr>
  74. </table>
  75. <p>Either outputFile or destdir must be supplied, but not both.&nbsp;</p>
  76. <h3>Examples</h3>
  77. <pre> &lt;javah destdir=&quot;c&quot; class=&quot;org.foo.bar.Wibble&quot; /&gt;</pre>
  78. <p>makes a JNI header of the named class, using the JDK1.2 JNI model. Assuming
  79. the directory 'c' already exists, the file <tt>org_foo_bar_Wibble.h</tt>
  80. is created there. If this file already exists, it is left unchanged.</p>
  81. <pre> &lt;javah outputFile=&quot;wibble.h&quot;&gt;
  82. &lt;class name=&quot;org.foo.bar.Wibble,org.foo.bar.Bobble&quot;/&gt;
  83. &lt;/javah&gt;</pre>
  84. <p>is similar to the previous example, except the output is written to a file
  85. called <tt>wibble.h</tt>
  86. in the current directory.</p>
  87. <pre> &lt;javah destdir=&quot;c&quot; force=&quot;yes&quot;&gt;
  88. &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
  89. &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
  90. &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
  91. &lt;/javah&gt;</pre>
  92. <p>writes three header files, one for each of the classes named. Because the
  93. force option is set, these header files are always written when the Javah task
  94. is invoked, even if they already exist.</p>
  95. <pre> &lt;javah destdir=&quot;c&quot; verbose=&quot;yes&quot; old=&quot;yes&quot; force=&quot;yes&quot;&gt;
  96. &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
  97. &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
  98. &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
  99. &lt;/javah&gt;
  100. &lt;javah destdir=&quot;c&quot; verbose=&quot;yes&quot; stubs=&quot;yes&quot; old=&quot;yes&quot; force=&quot;yes&quot;&gt;
  101. &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
  102. &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
  103. &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
  104. &lt;/javah&gt;</pre>
  105. <p>writes the headers for the three classes using the 'old' JNI format, then
  106. writes the corresponding .c stubs. The verbose option will cause Javah to
  107. describe its progress.</p>
  108. <hr>
  109. <hr>
  110. <p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
  111. Reserved.</p>
  112. </body>
  113. </html>