ProgramDriver (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: ProgramDriver

Package org.apache.hadoop.util

# Class ProgramDriver

java.lang.Object
org.apache.hadoop.util.ProgramDriver

@LimitedPrivate({"HDFS","MapReduce"}) @Unstable public class ProgramDriver extends Object
A driver that is used to run programs added to it

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProgramDriver()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addClass(String name, Class<?> mainClass, String description)`
  This is the method that adds the classed to the repository.
  `void`
  `driver(String[] argv)`
  API compatible with Hadoop 1.x.
  `int`
  `run(String[] args)`
  This is a driver for the example programs.

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

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

- ## Constructor Details

  - ### ProgramDriver

    public ProgramDriver()

- ## Method Details

  - ### addClass

    public void addClass(String name, Class<?> mainClass, String description) throws Throwable
    This is the method that adds the classed to the repository.
    Parameters:
      `name` - The name of the string you want the class instance to be called with
      `mainClass` - The class that you want to add to the repository
      `description` - The description of the class
    Throws:
      `NoSuchMethodException` - when a particular method cannot be found.
      `SecurityException` - security manager to indicate a security violation.
      `Throwable`

  - ### run

    public int run(String[] args) throws Throwable
    This is a driver for the example programs. It looks at the first command line argument and tries to find an example program with that name. If it is found, it calls the main method in that class with the rest of the command line arguments.
    Parameters:
      `args` - The argument from the user. args[0] is the command to run.
    Returns:
      -1 on error, 0 on success
    Throws:
      `NoSuchMethodException` - when a particular method cannot be found.
      `SecurityException` - security manager to indicate a security violation.
      `IllegalAccessException` - for backward compatibility.
      `IllegalArgumentException` - if the arg is invalid.
      `Throwable` - Anything thrown by the example program's main

  - ### driver

    public void driver(String[] argv) throws Throwable
    API compatible with Hadoop 1.x.
    Parameters:
      `argv` - argv.
    Throws:
      `Throwable` - Anything thrown by the example program's main