org.apache.tools.ant.taskdefs.optional

Class Javah

public class Javah extends Task

Generates JNI header files using javah. This task can take the following arguments: Of these arguments, either outputFile or destdir is required, but not both. More than one classname may be specified, using a comma-separated list or by using <class name="xxx"> elements within the task.

When this task executes, it will generate C header and source files that are needed to implement native methods.

Nested Class Summary
classJavah.ClassArgument
Constructor Summary
Javah()
Method Summary
ImplementationSpecificArgumentcreateArg()
Adds an implementation specific command-line argument.
PathcreateBootclasspath()
Adds path to bootstrap class files.
Javah.ClassArgumentcreateClass()
Adds class to process.
PathcreateClasspath()
Path to use for classpath.
voidexecute()
Execute the task
PathgetBootclasspath()
The bootclasspath to use.
String[]getClasses()
Names of the classes to process.
PathgetClasspath()
The classpath to use.
String[]getCurrentArgs()
Returns the (implementation specific) settings given as nested arg elements.
FilegetDestdir()
The destination directory, if any.
booleangetForce()
Whether output files should always be written.
booleangetOld()
Whether old JDK1.0-style header files should be generated.
FilegetOutputfile()
The destination file, if any.
booleangetStubs()
Whether C declarations from the Java object file should be generated.
booleangetVerbose()
Whether verbose output should get generated.
voidlogAndAddFiles(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
protected voidlogAndAddFilesToCompile(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
voidsetBootclasspath(Path src)
location of bootstrap class files.
voidsetBootClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.
voidsetClass(String cls)
the fully-qualified name of the class (or classes, separated by commas).
voidsetClasspath(Path src)
the classpath to use.
voidsetClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.
voidsetDestdir(File destDir)
Set the destination directory into which the Java source files should be compiled.
voidsetForce(boolean force)
If true, output files should always be written (JDK1.2 only).
voidsetImplementation(String impl)
Choose the implementation for this particular task.
voidsetOld(boolean old)
If true, specifies that old JDK1.0-style header files should be generated. (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)
voidsetOutputFile(File outputFile)
Concatenates the resulting header or source files for all the classes listed into this file.
voidsetStubs(boolean stubs)
If true, generate C declarations from the Java object file (used with old).
voidsetVerbose(boolean verbose)
If true, causes Javah to print a message concerning the status of the generated files.

Constructor Detail

Javah

public Javah()

Method Detail

createArg

public ImplementationSpecificArgument createArg()
Adds an implementation specific command-line argument.

Returns: a ImplementationSpecificArgument to be configured

Since: Ant 1.6.3

createBootclasspath

public Path createBootclasspath()
Adds path to bootstrap class files.

createClass

public Javah.ClassArgument createClass()
Adds class to process.

createClasspath

public Path createClasspath()
Path to use for classpath.

execute

public void execute()
Execute the task

Throws: BuildException is there is a problem in the task execution.

getBootclasspath

public Path getBootclasspath()
The bootclasspath to use.

Since: Ant 1.6.3

getClasses

public String[] getClasses()
Names of the classes to process.

Since: Ant 1.6.3

getClasspath

public Path getClasspath()
The classpath to use.

Since: Ant 1.6.3

getCurrentArgs

public String[] getCurrentArgs()
Returns the (implementation specific) settings given as nested arg elements.

Since: Ant 1.6.3

getDestdir

public File getDestdir()
The destination directory, if any.

Since: Ant 1.6.3

getForce

public boolean getForce()
Whether output files should always be written.

Since: Ant 1.6.3

getOld

public boolean getOld()
Whether old JDK1.0-style header files should be generated.

Since: Ant 1.6.3

getOutputfile

public File getOutputfile()
The destination file, if any.

Since: Ant 1.6.3

getStubs

public boolean getStubs()
Whether C declarations from the Java object file should be generated.

Since: Ant 1.6.3

getVerbose

public boolean getVerbose()
Whether verbose output should get generated.

Since: Ant 1.6.3

logAndAddFiles

public void logAndAddFiles(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"

logAndAddFilesToCompile

protected void logAndAddFilesToCompile(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"

setBootclasspath

public void setBootclasspath(Path src)
location of bootstrap class files.

setBootClasspathRef

public void setBootClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.

UNKNOWN: this needs to be documented in the HTML

setClass

public void setClass(String cls)
the fully-qualified name of the class (or classes, separated by commas).

setClasspath

public void setClasspath(Path src)
the classpath to use.

setClasspathRef

public void setClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.

UNKNOWN: this needs to be documented in the HTML docs

setDestdir

public void setDestdir(File destDir)
Set the destination directory into which the Java source files should be compiled.

setForce

public void setForce(boolean force)
If true, output files should always be written (JDK1.2 only).

setImplementation

public void setImplementation(String impl)
Choose the implementation for this particular task.

Parameters: impl the name of the implemenation

Since: Ant 1.6.3

setOld

public void setOld(boolean old)
If true, specifies that old JDK1.0-style header files should be generated. (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)

setOutputFile

public void setOutputFile(File outputFile)
Concatenates the resulting header or source files for all the classes listed into this file.

setStubs

public void setStubs(boolean stubs)
If true, generate C declarations from the Java object file (used with old).

setVerbose

public void setVerbose(boolean verbose)
If true, causes Javah to print a message concerning the status of the generated files.
Copyright