请输入您要查询的百科知识:

 

词条 javah
释义

百科名片

javah 是java语言 C 头文件和 stub 文件生成器。

结构

javah [ options ] classname. . .

javah_g [ options ] classname. . .

说明

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

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 concatenate 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. javah can still be used with the -jni option to generate native method function proptotypes needed for JNI-style native methods. The result is placed in the .h file.

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

OPTIONS

-o outputfile

Concatenates the resulting header or source files for all the classes listed on the command line into outputfile.

-d directory

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

-td directory

Overrides the default directory where javah stores temporary files. The default is /tmp.

-stubs

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

-v

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

-help

Print out this help message.

-trace

Add tracing information to the stubs file.

-version

Print out build version.

-jni

Causes javah to create an output file containing JNI-style native method function prototypes.

-classpath path

Specifies the path javah 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 path is:

实例

For example:

.:/home/avh/classes:/usr/local/java/classes

ENVIRONMENT VARIABLES

CLASSPATH

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

.:/home/avh/classes:/usr/local/java/classes

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/4 9:35:19