hadoop jar command runs a program contained in a JAR file. Users can bundle their MapReduce code in a JAR file and execute it using this command.
hadoop jar <jar> [<arguments>]
The following commands parameters are supported for
The JAR file.
Arguments to the program specified in the JAR file.
Hadoop streaming jobs are run using the
hadoop jar command. The Hadoop streaming utility enables you to create and run MapReduce jobs with any executable or script as the mapper and/or the reducer.
-reducer streaming command options are all required for streaming jobs. Either an executable or a Java class may be used for the mapper and the reducer. For more information about and examples of streaming jobs, see Streaming Options and Usage at the Apache project's page.
Running from a JAR file
The simple Word Count program is another example of a program that is run using the
hadoop jar command. The
wordcount functionality is built into the
hadoop-0.20.2-dev-examples.jar program. You pass the file, along with the location, to Hadoop with the
hadoop jar command and Hadoop reads the JAR file and executes the relevant instructions.
The Word Count program reads files from an input directory, counts the words, and writes the results of the job to files in an output directory.