Team LiB
Previous Section Next Section

javahNative Method C Stub Generator

Synopsis

javah [ options ] classnames

Description

javah generates C header and source files (.h and .c files) that are used when implementing Java native methods in C. The preferred native method interface changed between Java 1.0 and Java 1.1. In Java 1.1 and earlier, javah generated files for old-style native methods. In Java 1.1, the -jni option specified that javah should generate new-style files. In Java 1.2 and later, this option is the default.

This section describes only how to use javah. A full description of how to implement Java native methods in C is beyond the scope of this book.

Options


-bootclasspath

Specifies the path to search for system classes. See javac for further discussion. Java 1.2 and later.


-classpath path

Specifies the path javah uses to look up the classes named on the command line. This option overrides any path specified by the CLASSPATH environment variable. Prior to Java 1.2, this option can specify the location of the system classes and extensions. In Java 1.2 and later, it specifies only the location of application classes. See -bootclasspath. See also java for further discussion of the classpath.


-d directory

Specifies the directory into which javah stores the files it generates. By default, it stores them in the current directory. This option cannot be used with -o.


-force

Causes javah to always write output files, even if they contain no useful content.


-help

Causes javah to display a simple usage message and exit.


-J javaopt

Passes the option javaopt to the Java interpreter.


-jni

Specifies that javah should output header files for use with the Java Native Interface (JNI) rather than the old JDK 1.0 native interface. This option is the default in Java 1.2 and later. See also -old. Java 1.1 and later.


-o outputfile

Combines all output into a single file, outputfile, instead of creating separate files for each specified class.


-old

Outputs files for Java 1.0-style native methods. Prior to Java 1.2, this was the default. See also -jni. Java 1.2 and later.


-stubs

Generates .c stub files for the class or classes instead of header files. This option is only for the Java 1.0 native methods interface. See -old.


-trace

Specifies that javah should include tracing output commands in the stub files it generates. In Java 1.2 and later, this option is obsolete and has been removed. In its place, you can use the -verbose:jni option of the Java interpreter.


-v, -verbose

Specifies verbose mode. Causes javah to print messages about what it is doing. In Java 1.2 and later, -verbose is a synonym.


-version

Causes javah to display its version number.

Environment


CLASSPATH

Specifies the default classpath javah searches to find the specified classes. See java for a further discussion of the classpath.

See also

java, javac

    Team LiB
    Previous Section Next Section