Mac Developer Library Developer


This manual page is part of Xcode Tools version 5.0

To obtain these tools:

If you are running a version of Xcode Tools other than 5.0, view the documentation locally:

  • In Xcode

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • To learn how the manual is organized or to learn about command syntax, read the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Developer Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.

javah(1)                                                                                            javah(1)

       javah - C header and stub file generator

       javah [ options ] fully-qualified-classname ...
       javah_g [ options ] fully-qualified-classname ...

       The  javah  command  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 instance  variables  of  an
       object  from  native  source code. The .h file contains a structure definition whose layout parallels
       that of the corresponding class. The fields in the structure correspond to instance variables in  the

       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 javah 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.

       By  default, javah creates a header file for each class listed on the command line and puts the files
       in the current directory. Use the -stubs option to create source files. Use the -o option to concate-nate concatenate
       nate the results for all listed classes into a single file.

       The  new native method interface, Java Native Interface (JNI), does not require header information or
       stub files.  The javah command can still be used to generate native method function prototypes needed
       for  JNI-style  native methods.  javah produces JNI-style output by default, and places the result in
       the .h file.

       The javah_g version is a non-optimized version of javah suitable for use with debuggers like jdb.

       The following options are supported:

       -o outputfile  Concatenates the resulting header or source files for all the classes  listed  on  the
                      command line into outputfile.  Only the -o or -d option may be used.

       -bootclasspath path
                      Specifies  path  from  which  to  load  bootstrap  classes.  By default, the bootstrap
                      classes  are  the  classes  implementing  the  core  Java  2   platform   located   in
                      jre/lib/rt.jar and several other jar files.

       -classpath path
                      Specifies  the path javah uses to look up classes. Overrides the default of the CLASS-PATH CLASSPATH
                      PATH environment variable if it is set. Directories are separated by colons. Thus  the
                      general format for path is:


                      For example:


       -d directory   Sets the directory where javah saves the header files or the stub files.

       -force         Specifies that output files should always be written.

       -help          Prints help message for javah usage.

       -jni           Causes javah to create an output file containing JNI-style native method function pro-totypes. prototypes.
                      totypes.  This is the default output, so use of -jni is optional.

       -old           Specifies the old JDK1.0-style header files should be generated.

       -stubs         Causes javah to generate C declarations from the Java object file.

       -trace         Tracing is no longer supported.  Instead, use the -verbose:jni option of  the  virtual

       -verbose       Indicates  verbose output and causes javah to print a message to stdout concerning the
                      status of the generated files.

       -version       Print out javah version information.

       -Joption       Pass option to the Java virtual machine, where option is one of the options  described
                      on  the  man  page  for the java application launcher, java(1). For example, -J-Xms48m
                      sets the startup memory to 48 megabytes. It is a common  convention  for  -J  to  pass
                      options to the underlying virtual machine.

       CLASSPATH      Used to provide the system with a path to user-defined classes.  Directories are sepa-rated separated
                      rated by colons, for example,


       java(1), javac(1), javadoc(1), javap(1), jdb(1)

                                                13 June 2000                                        javah(1)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.