1javah(1) Basic Tools javah(1)
2
3
4
6 javah - Generates C header and source files from a Java class.
7
9 javah [ options ] fully-qualified-class-name ...
10
11
12 options
13 The command-line options. See Options.
14
15 fully-qualified-class-name
16 The fully qualified location of the classes to be converted to C
17 header and source files.
18
20 The javah command generates C header and source files that are needed
21 to implement native methods. The generated header and source files are
22 used by C programs to reference an object's instance variables from
23 native source code. The .h file contains a struct definition with a
24 layout that parallels the layout of the corresponding class. The fields
25 in the struct correspond to instance variables in the class.
26
27 The name of the header file and the structure declared within it are
28 derived from the name of the class. When the class passed to the javah
29 command is inside a package, the package name is added to the beginning
30 of both the header file name and the structure name. Underscores (_)
31 are used as name delimiters.
32
33 By default the javah command creates a header file for each class
34 listed on the command line and puts the files in the current directory.
35 Use the -stubs option to create source files. Use the -o option to
36 concatenate the results for all listed classes into a single file.
37
38 The Java Native Interface (JNI) does not require header information or
39 stub files. The javah command can still be used to generate native
40 method function prototypes needed for JNI-style native methods. The
41 javah command produces JNI-style output by default and places the
42 result in the .h file.
43
45 -o outputfile
46 Concatenates the resulting header or source files for all the
47 classes listed on the command line into an output file. Only one
48 of -o or -d can be used.
49
50 -d directory
51 Sets the directory where the javah command saves the header
52 files or the stub files. Only one of -d or -o can be used.
53
54 -stubs
55 Causes the javah command to generate C declarations from the
56 Java object file.
57
58 -verbose
59 Indicates verbose output and causes the javah command to print a
60 message to stdout about the status of the generated files.
61
62 -help
63 Prints a help message for javah usage.
64
65 -version
66 Prints javah command release information.
67
68 -jni
69 Causes the javah command to create an output file containing
70 JNI-style native method function prototypes. This is the default
71 output; use of -jni is optional.
72
73 -classpath path
74 Specifies the path the javah command uses to look up classes.
75 Overrides the default or the CLASSPATH environment variable when
76 it is set. Directories are separated by colons on Oracle Solaris
77 and semicolons on Windows. The general format for path is:
78
79 Oracle Solaris:
80
81 .:your-path
82
83 Example: .:/home/avh/classes:/usr/local/java/classes
84
85 Windows:
86
87 .;your-path
88
89 Example: .;C:\users\dac\classes;C:\tools\java\classes
90
91 As a special convenience, a class path element that contains a
92 base name of * is considered equivalent to specifying a list of
93 all the files in the directory with the extension .jar or .JAR.
94
95 For example, if directory mydir contains a.jar and b.JAR, then
96 the class path element mydir/* is expanded to a A.jar:b.JAR,
97 except that the order of jar files is unspecified. All JAR files
98 in the specified directory, including hidden ones, are included
99 in the list. A class path entry that consists of * expands to a
100 list of all the JAR files in the current directory. The
101 CLASSPATH environment variable, where defined, is similarly
102 expanded. Any class path wild card expansion occurs before the
103 Java Virtual Machine (JVM) is started. A Java program will never
104 see unexpanded wild cards except by querying the environment.
105 For example, by calling System.getenv("CLASSPATH").
106
107 -bootclasspath path
108 Specifies the path from which to load bootstrap classes. By
109 default, the bootstrap classes are the classes that implement
110 the core Java platform located in jre\lib\rt.jar and several
111 other JAR files.
112
113 -old
114 Specifies that old JDK 1.0-style header files should be
115 generated.
116
117 -force
118 Specifies that output files should always be written.
119
120 -Joption
121 Passes option to the Java Virtual Machine, where option is one
122 of the options described on the reference page for the Java
123 application launcher. For example, -J-Xms48m sets the startup
124 memory to 48 MB. See java(1).
125
127 · javah(1)
128
129 · java(1)
130
131 · jdb(1)
132
133 · javap(1)
134
135 · javadoc(1)
136
137
138
139JDK 8 21 November 2013 javah(1)