2692
|
1 |
." Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
|
2
|
2 |
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
3 |
."
|
|
4 |
." This code is free software; you can redistribute it and/or modify it
|
|
5 |
." under the terms of the GNU General Public License version 2 only, as
|
|
6 |
." published by the Free Software Foundation.
|
|
7 |
."
|
|
8 |
." This code is distributed in the hope that it will be useful, but WITHOUT
|
|
9 |
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
10 |
." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
11 |
." version 2 for more details (a copy is included in the LICENSE file that
|
|
12 |
." accompanied this code).
|
|
13 |
."
|
|
14 |
." You should have received a copy of the GNU General Public License version
|
|
15 |
." 2 along with this work; if not, write to the Free Software Foundation,
|
|
16 |
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
17 |
."
|
|
18 |
." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
19 |
." CA 95054 USA or visit www.sun.com if you need additional information or
|
|
20 |
." have any questions.
|
2692
|
21 |
."
|
|
22 |
.TH javah 1 "04 May 2009"
|
|
23 |
." Generated from HTML by html2man (author: Eric Armstrong)
|
2
|
24 |
|
|
25 |
.LP
|
2692
|
26 |
.SH "Name"
|
2
|
27 |
javah \- C Header and Stub File Generator
|
|
28 |
.LP
|
2692
|
29 |
.RS 3
|
2
|
30 |
|
|
31 |
.LP
|
|
32 |
.LP
|
|
33 |
\f3javah\fP produces C header files and C source files from a Java class. These files provide the connective glue that allow your Java and C code to interact.
|
|
34 |
.LP
|
2692
|
35 |
.RE
|
2
|
36 |
.SH "SYNOPSIS"
|
|
37 |
.LP
|
|
38 |
|
|
39 |
.LP
|
|
40 |
.nf
|
|
41 |
\f3
|
|
42 |
.fl
|
|
43 |
javah [ \fP\f3options\fP\f3 ] fully\-qualified\-classname. . .
|
|
44 |
.fl
|
|
45 |
javah_g [ \fP\f3options\fP\f3 ] fully\-qualified\-classname. . .
|
|
46 |
.fl
|
|
47 |
\fP
|
|
48 |
.fi
|
|
49 |
|
|
50 |
.LP
|
|
51 |
.SH "DESCRIPTION"
|
|
52 |
.LP
|
|
53 |
|
|
54 |
.LP
|
|
55 |
.LP
|
|
56 |
\f3javah\fP generates C header and source files that are needed to implement native methods. The generated header and source files are used by C programs to reference an object's instance variables from native source code. The .h file contains a struct definition whose layout parallels the layout of the corresponding class. The fields in the struct correspond to instance variables in the class.
|
|
57 |
.LP
|
|
58 |
.LP
|
|
59 |
The name of the header file and the structure declared within it are derived from the name of the class. If the class passed to \f3javah\fP is inside a package, the package name is prepended to both the header file name and the structure name. Underscores (_) are used as name delimiters.
|
|
60 |
.LP
|
|
61 |
.LP
|
|
62 |
By default \f3javah\fP creates a header file for each class listed on the command line and puts the files in the current directory. Use the \f2\-stubs\fP option to create source files. Use the \f2\-o\fP option to concatenate the results for all listed classes into a single file.
|
|
63 |
.LP
|
|
64 |
.LP
|
|
65 |
The new native method interface, Java Native Interface (JNI), does not require header information or stub files. \f3javah\fP can still be used to generate native method function proptotypes needed for JNI\-style native methods. \f3javah\fP produces JNI\-style output by default, and places the result in the .h file.
|
|
66 |
.LP
|
|
67 |
.LP
|
2692
|
68 |
\f3javah_g\fP is a non\-optimized version of \f3javah\fP suitable for use with debuggers like jdb(1).
|
2
|
69 |
.LP
|
|
70 |
.SH "OPTIONS"
|
|
71 |
.LP
|
|
72 |
|
|
73 |
.LP
|
2692
|
74 |
.RS 3
|
2
|
75 |
.TP 3
|
|
76 |
\-o outputfile
|
|
77 |
Concatenates the resulting header or source files for all the classes listed on the command line into \f2outputfile\fP. Only one of \f3\-o\fP or \f3\-d\fP may be used.
|
|
78 |
.TP 3
|
|
79 |
\-d directory
|
|
80 |
Sets the directory where \f3javah\fP saves the header files or the stub files. Only one of \f3\-d\fP or \f3\-o\fP may be used.
|
|
81 |
.TP 3
|
|
82 |
\-stubs
|
|
83 |
Causes \f3javah\fP to generate C declarations from the Java object file.
|
|
84 |
.TP 3
|
|
85 |
\-verbose
|
|
86 |
Indicates verbose output and causes \f3javah\fP to print a message to stdout concerning the status of the generated files.
|
|
87 |
.TP 3
|
|
88 |
\-help
|
|
89 |
Print help message for \f3javah\fP usage.
|
|
90 |
.TP 3
|
|
91 |
\-version
|
|
92 |
Print out \f3javah\fP version information.
|
|
93 |
.TP 3
|
|
94 |
\-jni
|
|
95 |
Causes \f3javah\fP to create an output file containing JNI\-style native method function prototypes. This is the default output, so use of \f3\-jni\fP is optional.
|
|
96 |
.TP 3
|
|
97 |
\-classpath path
|
|
98 |
Specifies the path \f3javah\fP uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. Directories are separated by colons. Thus the general format for \f2path\fP is:
|
|
99 |
.nf
|
|
100 |
\f3
|
|
101 |
.fl
|
|
102 |
.:<your_path>
|
|
103 |
.fl
|
|
104 |
\fP
|
|
105 |
.fi
|
|
106 |
For example:
|
|
107 |
.nf
|
|
108 |
\f3
|
|
109 |
.fl
|
|
110 |
.:/home/avh/classes:/usr/local/java/classes
|
|
111 |
.fl
|
|
112 |
\fP
|
|
113 |
.fi
|
|
114 |
.LP
|
|
115 |
As a special convenience, a class path element containing a basename of \f2*\fP is considered equivalent to specifying a list of all the files in the directory with the extension \f2.jar\fP or \f2.JAR\fP (a java program cannot tell the difference between the two invocations).
|
|
116 |
.br
|
|
117 |
.br
|
2692
|
118 |
For example, if directory \f2foo\fP contains \f2a.jar\fP and \f2b.JAR\fP, then the class path element \f2foo/*\fP is expanded to a \f2A.jar:b.JAR\fP, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of \f2*\fP expands to a list of all the jar files in the current directory. The \f2CLASSPATH\fP environment variable, where defined, will be similarly expanded. Any classpath wildcard expansion occurs before the Java virtual machine is started \-\- no Java program will ever see unexpanded wildcards except by querying the environment. For example; by invoking \f2System.getenv("CLASSPATH")\fP.
|
2
|
119 |
.TP 3
|
|
120 |
\-bootclasspath path
|
|
121 |
Specifies path from which to load bootstrap classes. By default, the bootstrap classes are the classes implementing the core Java 2 platform located in \f2jre/lib/rt.jar\fP and several other jar files.
|
|
122 |
.TP 3
|
|
123 |
\-old
|
|
124 |
Specifies that old JDK1.0\-style header files should be generated.
|
|
125 |
.TP 3
|
|
126 |
\-force
|
|
127 |
Specifies that output files should always be written.
|
|
128 |
.TP 3
|
|
129 |
\-Joption
|
2692
|
130 |
Pass \f2option\fP to the Java virtual machine, where \f2option\fP is one of the options described on the reference page for the java(1). For example, \f3\-J\-Xms48m\fP sets the startup memory to 48 megabytes.
|
|
131 |
.RE
|
|
132 |
|
2
|
133 |
.LP
|
|
134 |
.SH "ENVIRONMENT VARIABLES"
|
|
135 |
.LP
|
|
136 |
|
|
137 |
.LP
|
2692
|
138 |
.RS 3
|
2
|
139 |
.TP 3
|
|
140 |
CLASSPATH
|
|
141 |
Used to provide the system a path to user\-defined classes. Directories are separated by colons, for example,
|
|
142 |
.nf
|
|
143 |
\f3
|
|
144 |
.fl
|
|
145 |
.:/home/avh/classes:/usr/local/java/classes
|
|
146 |
.fl
|
|
147 |
\fP
|
|
148 |
.fi
|
2692
|
149 |
.RE
|
2
|
150 |
|
|
151 |
.LP
|
|
152 |
.SH "SEE ALSO"
|
|
153 |
.LP
|
|
154 |
|
|
155 |
.LP
|
|
156 |
.LP
|
2692
|
157 |
javac(1), java(1), jdb(1), javap(1), javadoc(1)
|
2
|
158 |
.LP
|
|
159 |
|
|
160 |
.LP
|
|
161 |
|