hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Haoming Zhang <haoming.zh...@outlook.com>
Subject How to get Hadoop's Generic Options value
Date Thu, 19 Feb 2015 21:03:59 GMT
Hi,

 


        As you know, Hadoop support the Generic Options. For example you can use "-files"
to specify files to be copied to the map reduce cluster.




But how to get the value of Generic Options? For example, I have a command that is :



  hadoop jar job.jar JobClass -files
  /home/MapReduce/testFile.json input output



I'm using the generic option "-files", and the value of 
this option is "/home/MapReduce/testFile.json", so how can I get this 
value?




I tried GenericOptionsParser class like this:


String option = new GenericOptionsParser(conf, args).getCommandLine().getOptionValue("files");

But the result was NULL. I also changed the parameter of .getOptionValue() to "-files", got
NULL as well.




And I also tried the code like this:


String[] toolArgs = new GenericOptionsParser(conf, args).getRemainingArgs();

But the above code only get all the remaining command options other 
than the generic options, that is the contrary of my expectation.


Any suggestion will be great appreciated!


Thanks,
Haoming



     		 	   		  
Mime
View raw message