title: Getting ERROR 4010 when trying to run Pig through Java
body: <p>I'm trying to run a Pig script through Java. Here's what my code looks like right now:</p>
  
  <pre><code>public static void main(String[] args) throws JSONException, InterruptedException, IOException {    
      Properties props = new Properties();
      props.setProperty("fs.default.name", "hdfs://&lt;some-value&gt;:8020");
      props.setProperty("mapred.job.tracker", "&lt;some-value&gt;:54311");
      PigServer pigServer = new PigServer(ExecType.MAPREDUCE, props);
  
      Map&lt;String, String&gt; params = new LinkedHashMap&lt;String, String&gt;();
      params.put("INPUT_PATH", "hdfs://&lt;some-input-value&gt;");
      params.put("OUTPUT_FILE", "hdfs:///user/&lt;some-username&gt;/last-login-out");
  
      pigServer.registerScript("last-login-by-userid.pig", params);
  }
  </code></pre>
  
  <p>But whenever I run the program, I get:</p>
  
  <pre><code>Exception in thread "main" org.apache.pig.backend.executionengine.ExecException: ERROR 4010: Cannot find hadoop configurations in classpath (neither hadoop-site.xml nor core-site.xml was found in the classpath). If you plan to use local mode, please put -x local option in command line.
  </code></pre>
  
  <p>I've moved the <code>pig-0.10.1</code> folder that I downloaded from the Apache website into <code>Applications</code> and have added <code>export PIG_HOME=/Applications/pig-0.10.1</code> in my <code>~/.bash_profile</code>.</p>
  
  <p>When I log into the <code>&lt;some-value&gt;:8020</code> server, I'm able to run the Pig script just fine.</p>