

package averagetemperature;
/**
 *
 * @author slave
 */
import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
 
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
 
public class AverageTemperature{
 
public static void main(String[] args) throws IOException{
 
 
    
JobConf conf= new JobConf(AverageTemperature.class);
conf.setJobName("Avg Temp");
 
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
 
conf.setMapperClass(AverageTemperatureMapper.class);
conf.setReducerClass(AverageTemperatureReducer.class);
 
FileInputFormat.addInputPath(conf, new Path(args[0])); //args[0] est l'argument input (fichier text) dans la directoire /input
FileOutputFormat.setOutputPath(conf,new Path(args[1])); //args[1] est l'argument output path .les resultat seront stocker dans ce path
 
FileSystem.getLocal(conf).delete(new Path(args[1]), true);
JobClient.runJob(conf);
 
}
 
}

@@ -1144,14 +1144,195 @@
 onf);%0A %0A
+ %0A //Dans le CLI executez la commande : hadoop jar %3Cpath de Java jar file %22/AverageTemerature/dist/AvgTemperature.jar%22%3E %3Cpath de hdfs%3E %3Cnom du programme a execute %22AvgTemperature%22%3E%0A
 %7D%0A %0A%7D%0A

Update AverageTemperature.java