hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 杨浩 <yangha...@gmail.com>
Subject Re: How to get Hadoop's Generic Options value
Date Fri, 20 Feb 2015 02:14:01 GMT
why not trying
>
>   -D files=/home/MapReduce/testFile.json


2015-02-20 5:03 GMT+08:00 Haoming Zhang <haoming.zhang@outlook.com>:

> Hi,
>
>
> As you know, Hadoop support the Generic Options
> <http://hadoop.apache.org/docs/r1.2.1/commands_manual.html#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
> <http://hadoop.apache.org/docs/r1.2.1/api/org/apache/hadoop/util/GenericOptionsParser.html>
> 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