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