title: pass Hadoop arguments into Java code
body: <p>I have an Uber jar that performs some Cascading ETL tasks. The jar is executed like this:</p>
  
  <pre><code>hadoop jar munge-data.jar
  </code></pre>
  
  <p>I'd like to pass arguments to the jar when the job is launched, e.g.</p>
  
  <pre><code>hadoop jar munge-data.jar -Denv=prod
  </code></pre>
  
  <p>Different credentials, hostnames, etc... will be read from properties files depending on the environment.</p>
  
  <p>This would work if the job were executed <code>java jar munge-data.jar -Denv=prod</code>, since the <code>env</code> property could be accessed:</p>
  
  <pre><code>System.getProperty("env")
  </code></pre>
  
  <p>However, this doesn't work when the jar is executed <code>hadoop jar ...</code>. </p>
  
  <p>I saw a <a href="https://stackoverflow.com/questions/15490090/how-to-specify-system-property-in-hadoop-except-modify-hadoop-env-sh" title="similar thread">similar thread</a> where the answerer states that properties can be accessed using what looks like the org.apache.hadoop.conf.Configuration class. It wasn't clear to me, from the answer, how the <code>conf</code> object gets created. I tried the following and it returned <code>null</code>:</p>
  
  <pre><code>Configuration configuration = new Configuration();
  System.out.println(configuration.get("env"));
  </code></pre>
  
  <p>Presumably, the configuration properties need to be read/set.</p>
  
  <p>Can you tell me how I can pass properties, e.g. <code>hadoop jar [...] -DsomeProperty=someValue</code>, into my ETL job?</p>