jdk/src/solaris/doc/sun/man/man1/javah.1
changeset 2 90ce3da70b43
child 2692 345bc8d65b19
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 .'" t
       
     2 ." Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
       
     3 ." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4 ."
       
     5 ." This code is free software; you can redistribute it and/or modify it
       
     6 ." under the terms of the GNU General Public License version 2 only, as
       
     7 ." published by the Free Software Foundation.
       
     8 ."
       
     9 ." This code is distributed in the hope that it will be useful, but WITHOUT
       
    10 ." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11 ." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12 ." version 2 for more details (a copy is included in the LICENSE file that
       
    13 ." accompanied this code).
       
    14 ."
       
    15 ." You should have received a copy of the GNU General Public License version
       
    16 ." 2 along with this work; if not, write to the Free Software Foundation,
       
    17 ." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18 ."
       
    19 ." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20 ." CA 95054 USA or visit www.sun.com if you need additional information or
       
    21 ." have any questions.
       
    22 ." ` 
       
    23 .TH javah 1 "05 Aug 2006"
       
    24 ." Generated by html2roff
       
    25 
       
    26 .LP
       
    27 .SH NAME
       
    28 javah \- C Header and Stub File Generator
       
    29 .LP
       
    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
       
    35 .SH "SYNOPSIS"
       
    36 .LP
       
    37 
       
    38 .LP
       
    39 .nf
       
    40 \f3
       
    41 .fl
       
    42 javah [ \fP\f3options\fP\f3 ] fully\-qualified\-classname. . .
       
    43 .fl
       
    44 javah_g [ \fP\f3options\fP\f3 ] fully\-qualified\-classname. . .
       
    45 .fl
       
    46 \fP
       
    47 .fi
       
    48 
       
    49 .LP
       
    50 .SH "DESCRIPTION"
       
    51 .LP
       
    52 
       
    53 .LP
       
    54 .LP
       
    55 \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.
       
    56 .LP
       
    57 .LP
       
    58 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.
       
    59 .LP
       
    60 .LP
       
    61 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.
       
    62 .LP
       
    63 .LP
       
    64 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.
       
    65 .LP
       
    66 .LP
       
    67 \f3javah_g\fP is a non\-optimized version of \f3javah\fP suitable for use with debuggers like \f3jdb\fP.
       
    68 .LP
       
    69 .SH "OPTIONS"
       
    70 .LP
       
    71 
       
    72 .LP
       
    73 .TP 3
       
    74 \-o outputfile 
       
    75 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. 
       
    76 .TP 3
       
    77 \-d directory 
       
    78 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. 
       
    79 .TP 3
       
    80 \-stubs 
       
    81 Causes \f3javah\fP to generate C declarations from the Java object file. 
       
    82 .TP 3
       
    83 \-verbose 
       
    84 Indicates verbose output and causes \f3javah\fP to print a message to stdout concerning the status of the generated files. 
       
    85 .TP 3
       
    86 \-help 
       
    87 Print help message for \f3javah\fP usage. 
       
    88 .TP 3
       
    89 \-version 
       
    90 Print out \f3javah\fP version information. 
       
    91 .TP 3
       
    92 \-jni 
       
    93 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. 
       
    94 .TP 3
       
    95 \-classpath path 
       
    96 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: 
       
    97 .nf
       
    98 \f3
       
    99 .fl
       
   100    .:<your_path>
       
   101 .fl
       
   102 \fP
       
   103 .fi
       
   104 For example: 
       
   105 .nf
       
   106 \f3
       
   107 .fl
       
   108    .:/home/avh/classes:/usr/local/java/classes
       
   109 .fl
       
   110 \fP
       
   111 .fi
       
   112 .LP
       
   113 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).
       
   114 .br
       
   115 .br
       
   116 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.    
       
   117 .TP 3
       
   118 \-bootclasspath path 
       
   119 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. 
       
   120 .TP 3
       
   121 \-old 
       
   122 Specifies that old JDK1.0\-style header files should be generated. 
       
   123 .TP 3
       
   124 \-force 
       
   125 Specifies that output files should always be written. 
       
   126 .TP 3
       
   127 \-Joption 
       
   128 Pass \f2option\fP to the Java virtual machine, where \f2option\fP is one of the options described on the reference page for the java application launcher. For example, \f3\-J\-Xms48m\fP sets the startup memory to 48 megabytes. 
       
   129 .LP
       
   130 .SH "ENVIRONMENT VARIABLES"
       
   131 .LP
       
   132 
       
   133 .LP
       
   134 .TP 3
       
   135 CLASSPATH 
       
   136 Used to provide the system a path to user\-defined classes. Directories are separated by colons, for example, 
       
   137 .nf
       
   138 \f3
       
   139 .fl
       
   140 .:/home/avh/classes:/usr/local/java/classes
       
   141 .fl
       
   142 \fP
       
   143 .fi
       
   144 
       
   145 .LP
       
   146 .SH "SEE ALSO"
       
   147 .LP
       
   148 
       
   149 .LP
       
   150 .LP
       
   151 javac, java, jdb, javap, javadoc
       
   152 .LP
       
   153 
       
   154 .LP
       
   155