Javah (Apache Ant API)
Date: 2015-06-29

org.apache.tools.ant.taskdefs.optional

## 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
  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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Javah.ClassArgument` A class corresponding the the nested "class" element.

  - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.Task

      `target, taskName, taskType, wrapper`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Javah()` No arg constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(JavahAdapter adapter)` Set the adapter explicitly.
    `void` | `addFileSet(FileSet fs)` Add a fileset.
    `ImplementationSpecificArgument` | `createArg()` Adds an implementation specific command-line argument.
    `Path` | `createBootclasspath()` Adds path to bootstrap class files.
    `Javah.ClassArgument` | `createClass()` Adds class to process.
    `Path` | `createClasspath()` Path to use for classpath.
    `Path` | `createImplementationClasspath()` The classpath to use when loading the javah implementation if it is not a built-in one.
    `void` | `execute()` Execute the task
    `Path` | `getBootclasspath()` The bootclasspath to use.
    `java.lang.String[]` | `getClasses()` Names of the classes to process.
    `Path` | `getClasspath()` The classpath to use.
    `java.lang.String[]` | `getCurrentArgs()` Returns the (implementation specific) settings given as nested arg elements.
    `java.io.File` | `getDestdir()` The destination directory, if any.
    `boolean` | `getForce()` Whether output files should always be written.
    `boolean` | `getOld()` Whether old JDK1.0-style header files should be generated.
    `java.io.File` | `getOutputfile()` The destination file, if any.
    `boolean` | `getStubs()` Whether C declarations from the Java object file should be generated.
    `boolean` | `getVerbose()` Whether verbose output should get generated.
    `void` | `logAndAddFiles(Commandline cmd)` Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
    `protected void` | `logAndAddFilesToCompile(Commandline cmd)` Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
    `void` | `setBootclasspath(Path src)` location of bootstrap class files.
    `void` | `setBootClasspathRef(Reference r)` To the bootstrap path, this adds a reference to a classpath defined elsewhere.
    `void` | `setClass(java.lang.String cls)` the fully-qualified name of the class (or classes, separated by commas).
    `void` | `setClasspath(Path src)` the classpath to use.
    `void` | `setClasspathRef(Reference r)` Adds a reference to a classpath defined elsewhere.
    `void` | `setDestdir(java.io.File destDir)` Set the destination directory into which the Java source files should be compiled.
    `void` | `setForce(boolean force)` If true, output files should always be written (JDK1.2 only).
    `void` | `setImplementation(java.lang.String impl)` Choose the implementation for this particular task.
    `void` | `setOld(boolean old)` If true, specifies that old JDK1.0-style header files should be generated.
    `void` | `setOutputFile(java.io.File outputFile)` Concatenates the resulting header or source files for all the classes listed into this file.
    `void` | `setStubs(boolean stubs)` If true, generate C declarations from the Java object file (used with old).
    `void` | `setVerbose(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.Task

      `bindToOwner, 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.ProjectComponent

      `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Javah

          public Javah()

      No arg constructor.

  - ### Method Detail

    - #### setClass

          public void setClass(java.lang.String cls)

      the fully-qualified name of the class (or classes, separated by commas).
      Parameters:
        `cls` - the classname (or classnames).

    - #### createClass

          public Javah.ClassArgument createClass()

      Adds class to process.
      Returns:
        a `ClassArgument` to be configured.

    - #### addFileSet

          public void addFileSet(FileSet fs)

      Add a fileset.
      Parameters:
        `fs` - the fileset to add.

    - #### getClasses

          public java.lang.String[] getClasses()

      Names of the classes to process.
      Returns:
        the array of classes.
      Since:
        Ant 1.6.3

    - #### setDestdir

          public void setDestdir(java.io.File destDir)

      Set the destination directory into which the Java source files should be compiled.
      Parameters:
        `destDir` - the destination directory.

    - #### getDestdir

          public java.io.File getDestdir()

      The destination directory, if any.
      Returns:
        the destination directory.
      Since:
        Ant 1.6.3

    - #### setClasspath

          public void setClasspath(Path src)

      the classpath to use.
      Parameters:
        `src` - the classpath.

    - #### createClasspath

          public Path createClasspath()

      Path to use for classpath.
      Returns:
        a path to be configured.

    - #### setClasspathRef

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

    - #### getClasspath

          public Path getClasspath()

      The classpath to use.
      Returns:
        the classpath.
      Since:
        Ant 1.6.3

    - #### setBootclasspath

          public void setBootclasspath(Path src)

      location of bootstrap class files.
      Parameters:
        `src` - the bootstrap classpath.

    - #### createBootclasspath

          public Path createBootclasspath()

      Adds path to bootstrap class files.
      Returns:
        a path to be configured.

    - #### setBootClasspathRef

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

    - #### getBootclasspath

          public Path getBootclasspath()

      The bootclasspath to use.
      Returns:
        the bootclass path.
      Since:
        Ant 1.6.3

    - #### setOutputFile

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

    - #### getOutputfile

          public java.io.File getOutputfile()

      The destination file, if any.
      Returns:
        the destination file.
      Since:
        Ant 1.6.3

    - #### setForce

          public void setForce(boolean force)

      If true, output files should always be written (JDK1.2 only).
      Parameters:
        `force` - the value to use.

    - #### getForce

          public boolean getForce()

      Whether output files should always be written.
      Returns:
        the force attribute.
      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).
      Parameters:
        `old` - if true use old 1.0 style header files.

    - #### getOld

          public boolean getOld()

      Whether old JDK1.0-style header files should be generated.
      Returns:
        the old attribute.
      Since:
        Ant 1.6.3

    - #### setStubs

          public void setStubs(boolean stubs)

      If true, generate C declarations from the Java object file (used with old).
      Parameters:
        `stubs` - if true, generated C declarations.

    - #### getStubs

          public boolean getStubs()

      Whether C declarations from the Java object file should be generated.
      Returns:
        the stubs attribute.
      Since:
        Ant 1.6.3

    - #### setVerbose

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

    - #### getVerbose

          public boolean getVerbose()

      Whether verbose output should get generated.
      Returns:
        the verbose attribute.
      Since:
        Ant 1.6.3

    - #### setImplementation

          public 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

    - #### createArg

          public ImplementationSpecificArgument createArg()

      Adds an implementation specific command-line argument.
      Returns:
        a ImplementationSpecificArgument to be configured.
      Since:
        Ant 1.6.3

    - #### getCurrentArgs

          public java.lang.String[] getCurrentArgs()

      Returns the (implementation specific) settings given as nested arg elements.
      Returns:
        the arguments.
      Since:
        Ant 1.6.3

    - #### createImplementationClasspath

          public Path createImplementationClasspath()

      The classpath to use when loading the javah implementation if it is not a built-in one.
      Since:
        Ant 1.8.0

    - #### add

          public void add(JavahAdapter adapter)

      Set the adapter explicitly.
      Since:
        Ant 1.8.0

    - #### execute

          public void execute()
                       throws BuildException

      Execute the task
      Overrides:
        `execute` in class `Task`
      Throws:
        `BuildException` - is there is a problem in the task execution.

    - #### logAndAddFiles

          public void logAndAddFiles(Commandline cmd)

      Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
      Parameters:
        `cmd` - the command line.

    - #### logAndAddFilesToCompile

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