I am writing a Mapreduce program. I have to pass the input file in key value pair So when I am writing
job.setInputFormatClass(KeyValueTextInputFormat.class);
the compiler is throwing an error saying that can’t use InputFormat. Can anyone help me out?
 Below is my code:
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.KeyValueTextInputFormat;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
import co.raghu.dictionary.Dictionary.AllTranslationsReducer;
import co.raghu.dictionary.Dictionary.WordMapper;
public class MRDriver {
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
    Configuration conf1 = new Configuration();
        String[] extraArgs = new GenericOptionsParser(conf1, args).getRemainingArgs();
        if (extraArgs.length != 2) {
          System.err.println("Usage: wordcount <input> <output>");
          System.exit(2);
        }
        Job job = new Job(conf1, "dictionary");
        System.out.println("Job= "+job.toString());
        job.setJarByClass(Dictionary.class);
        job.setMapperClass(WordMapper.class);
        job.setReducerClass(AllTranslationsReducer.class);
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);
        job.setInputFormatClass(KeyValueTextInputFormat.class);
        FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
        FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}