source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/manual/OptionalTasks/javah.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 4.7 KB
Line 
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
15are needed to implement native methods. JNI operates differently depending on
16whether <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>
18systems 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.&nbsp;</p>
80<h3>Examples</h3>
81<pre> &lt;javah destdir=&quot;c&quot; class=&quot;org.foo.bar.Wibble&quot;/&gt;</pre>
82<p>makes a JNI header of the named class, using the JDK1.2 JNI model. Assuming
83the directory 'c' already exists, the file <tt>org_foo_bar_Wibble.h</tt>
84is created there. If this file already exists, it is left unchanged.</p>
85<pre> &lt;javah outputFile=&quot;wibble.h&quot;&gt;
86 &lt;class name=&quot;org.foo.bar.Wibble,org.foo.bar.Bobble&quot;/&gt;
87 &lt;/javah&gt;</pre>
88<p>is similar to the previous example, except the output is written to a file
89called <tt>wibble.h</tt>
90in the current directory.</p>
91<pre> &lt;javah destdir=&quot;c&quot; force=&quot;yes&quot;&gt;
92 &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
93 &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
94 &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
95 &lt;/javah&gt;</pre>
96<p>writes three header files, one for each of the classes named. Because the
97force option is set, these header files are always written when the Javah task
98is invoked, even if they already exist.</p>
99<pre> &lt;javah destdir=&quot;c&quot; verbose=&quot;yes&quot; old=&quot;yes&quot; force=&quot;yes&quot;&gt;
100 &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
101 &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
102 &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
103 &lt;/javah&gt;
104 &lt;javah destdir=&quot;c&quot; verbose=&quot;yes&quot; stubs=&quot;yes&quot; old=&quot;yes&quot; force=&quot;yes&quot;&gt;
105 &lt;class name=&quot;org.foo.bar.Wibble&quot;/&gt;
106 &lt;class name=&quot;org.foo.bar.Bobble&quot;/&gt;
107 &lt;class name=&quot;org.foo.bar.Tribble&quot;/&gt;
108 &lt;/javah&gt;</pre>
109<p>writes the headers for the three classes using the 'old' JNI format, then
110writes the corresponding .c stubs. The verbose option will cause Javah to
111describe its progress.</p>
112
113<hr>
114<p align="center">Copyright &copy; 2001-2002,2004 The Apache Software Foundation. All rights
115Reserved.</p>
116</body>
117
118</html>
Note: See TracBrowser for help on using the repository browser.