Writing a job in hadoop generally adopts the following method: [java] Job job = new Job (); job. setXxx ();... in this way, there are a lot of codes, and the parameters are not easy to control. For example, I want to control the input parameters and write some code such as control parsing, as follows: [java] if (args. length! = 2) {System. err. out ("Usage <input> <output>")}. In addition, the above is only a rough judgment, but it is not very accurate. Is there a better way to reduce the amount of code without setting it? In fact, you can implement the AbstractJob class in Mahout, as follows: [java] package mahout. fansy. bayes. transform; import org. apache. hadoop. conf. configuration; import org. apache. hadoop. fs. path; import org. apache. hadoop. io. longWritable; import org. apache. hadoop. io. text; import org. apache. hadoop. mapreduce. job; import org. apache. hadoop. mapreduce. mapper; import org. apache. hadoop. mapreduce. lib. input. fileInputFormat; import org. apache. hadoop. mapreduce. lib. output. sequenceFileOutputFormat; import org. apache. hadoop. util. toolRunner; import org. apache. mahout. common. abstractJob; import org. apache. mahout. math. vectorWritable; public class extends actjob {@ Override public int run (String [] args) throws Exception {addInputOption (); addOutputOption (); addOption ("splitCharacter", "SC ", "vector split character, default is ','", ","); if (parseArguments (args) = null) {return-1;} Path input = getInputPath (); path output = getOutputPath (); String SC = getOption ("splitCharacter"); Job job = prepareJob (input, output, FileInputFormat. class, Mapper. class, LongWritable. class, Text. class, null, Text. class, VectorWritable. class, SequenceFileOutputFormat. class); job. getConfiguration (). set ("SC", SC); if (job. waitForCompletion (true) {return 0;} return-1 ;} /*** implement AbstractJob * @ param args * @ throws Exception */public static void main (String [] args) throws Exception {String [] arg = new String [] {"-I", "safdf", "-SC", "scccccccc", "-o ", "sdf"}; ToolRunner. run (new Configuration (), new TFText2VectorWritable (), arg );}}