Class Javah
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.optional.Javah
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 
 public class Javah extends Task Generates JNI header files using javah. This task can take the following arguments:- classname - the fully-qualified name of a class
- outputFile - Concatenates the resulting header or source files for all the classes listed into this file
- destdir - Sets the directory where javah saves the header files or the stub files
- classpath
- bootclasspath
- force - Specifies that output files should always be written (JDK1.2 only)
- old - Specifies that old JDK1.0-style header files should be generated (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)
- stubs - generate C declarations from the Java object file (used with old)
- verbose - causes javah to print a message to stdout concerning the status of the generated files
- extdirs - Override location of installed extensions
 <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 SummaryNested Classes Modifier and Type Class Description classJavah.ClassArgumentA class corresponding the the nested "class" element.
 - 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description Javah()No arg constructor.
 - 
Method SummaryModifier and Type Method Description voidadd(JavahAdapter adapter)Set the adapter explicitly.voidaddFileSet(FileSet fs)Add a fileset.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.PathcreateImplementationClasspath()The classpath to use when loading the javah implementation if it is not a built-in one.voidexecute()Execute the taskPathgetBootclasspath()The bootclasspath to use.java.lang.String[]getClasses()Names of the classes to process.PathgetClasspath()The classpath to use.java.lang.String[]getCurrentArgs()Returns the (implementation specific) settings given as nested arg elements.java.io.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.java.io.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)To the bootstrap path, this adds a reference to a classpath defined elsewhere.voidsetClass(java.lang.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(java.io.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(java.lang.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.voidsetOutputFile(java.io.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.- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Method Detail- 
setClasspublic void setClass(java.lang.String cls) the fully-qualified name of the class (or classes, separated by commas).- Parameters:
- cls- the classname (or classnames).
 
 - 
createClasspublic Javah.ClassArgument createClass() Adds class to process.- Returns:
- a ClassArgumentto be configured.
 
 - 
addFileSetpublic void addFileSet(FileSet fs) Add a fileset.- Parameters:
- fs- the fileset to add.
 
 - 
getClassespublic java.lang.String[] getClasses() Names of the classes to process.- Returns:
- the array of classes.
- Since:
- Ant 1.6.3
 
 - 
setDestdirpublic void setDestdir(java.io.File destDir) Set the destination directory into which the Java source files should be compiled.- Parameters:
- destDir- the destination directory.
 
 - 
getDestdirpublic java.io.File getDestdir() The destination directory, if any.- Returns:
- the destination directory.
- Since:
- Ant 1.6.3
 
 - 
setClasspathpublic void setClasspath(Path src) the classpath to use.- Parameters:
- src- the classpath.
 
 - 
createClasspathpublic Path createClasspath() Path to use for classpath.- Returns:
- a path to be configured.
 
 - 
setClasspathRefpublic void setClasspathRef(Reference r) Adds a reference to a classpath defined elsewhere.- Parameters:
- r- a reference to a classpath.
- To do:
- this needs to be documented in the HTML docs.
 
 - 
getClasspathpublic Path getClasspath() The classpath to use.- Returns:
- the classpath.
- Since:
- Ant 1.6.3
 
 - 
setBootclasspathpublic void setBootclasspath(Path src) location of bootstrap class files.- Parameters:
- src- the bootstrap classpath.
 
 - 
createBootclasspathpublic Path createBootclasspath() Adds path to bootstrap class files.- Returns:
- a path to be configured.
 
 - 
setBootClasspathRefpublic void setBootClasspathRef(Reference r) To the bootstrap path, this adds a reference to a classpath defined elsewhere.- Parameters:
- r- a reference to a classpath
- To do:
- this needs to be documented in the HTML.
 
 - 
getBootclasspathpublic Path getBootclasspath() The bootclasspath to use.- Returns:
- the bootclass path.
- Since:
- Ant 1.6.3
 
 - 
setOutputFilepublic void setOutputFile(java.io.File outputFile) Concatenates the resulting header or source files for all the classes listed into this file.- Parameters:
- outputFile- the output file.
 
 - 
getOutputfilepublic java.io.File getOutputfile() The destination file, if any.- Returns:
- the destination file.
- Since:
- Ant 1.6.3
 
 - 
setForcepublic void setForce(boolean force) If true, output files should always be written (JDK1.2 only).- Parameters:
- force- the value to use.
 
 - 
getForcepublic boolean getForce() Whether output files should always be written.- Returns:
- the force attribute.
- Since:
- Ant 1.6.3
 
 - 
setOldpublic 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).- Parameters:
- old- if true use old 1.0 style header files.
 
 - 
getOldpublic boolean getOld() Whether old JDK1.0-style header files should be generated.- Returns:
- the old attribute.
- Since:
- Ant 1.6.3
 
 - 
setStubspublic void setStubs(boolean stubs) If true, generate C declarations from the Java object file (used with old).- Parameters:
- stubs- if true, generated C declarations.
 
 - 
getStubspublic boolean getStubs() Whether C declarations from the Java object file should be generated.- Returns:
- the stubs attribute.
- Since:
- Ant 1.6.3
 
 - 
setVerbosepublic void setVerbose(boolean verbose) If true, causes Javah to print a message concerning the status of the generated files.- Parameters:
- verbose- if true, do verbose printing.
 
 - 
getVerbosepublic boolean getVerbose() Whether verbose output should get generated.- Returns:
- the verbose attribute.
- Since:
- Ant 1.6.3
 
 - 
setImplementationpublic void setImplementation(java.lang.String impl) Choose the implementation for this particular task.- Parameters:
- impl- the name of the implementation.
- Since:
- Ant 1.6.3
 
 - 
createArgpublic ImplementationSpecificArgument createArg() Adds an implementation specific command-line argument.- Returns:
- a ImplementationSpecificArgument to be configured.
- Since:
- Ant 1.6.3
 
 - 
getCurrentArgspublic java.lang.String[] getCurrentArgs() Returns the (implementation specific) settings given as nested arg elements.- Returns:
- the arguments.
- Since:
- Ant 1.6.3
 
 - 
createImplementationClasspathpublic Path createImplementationClasspath() The classpath to use when loading the javah implementation if it is not a built-in one.- Returns:
- Path
- Since:
- Ant 1.8.0
 
 - 
addpublic void add(JavahAdapter adapter) Set the adapter explicitly.- Parameters:
- adapter- JavahAdapter
- Since:
- Ant 1.8.0
 
 - 
executepublic void execute() throws BuildExceptionExecute the task- Overrides:
- executein class- Task
- Throws:
- BuildException- is there is a problem in the task execution.
 
 - 
logAndAddFilespublic void logAndAddFiles(Commandline cmd) Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"- Parameters:
- cmd- the command line.
 
 - 
logAndAddFilesToCompileprotected void logAndAddFilesToCompile(Commandline cmd) Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"- Parameters:
- cmd- the command line to add parameters to.
 
 
- 
 
-