title: running an oozie workflow using java code
body: <p>I'm new to java and having some trouble running an oozie job using java code. I am unable to figure out the problem in the code. Some help will be really appreciated. Here's my code</p>
  
  <pre><code>import java.util.Properties;
  
  import org.apache.oozie.client.OozieClient;
  import org.apache.oozie.client.WorkflowJob;
  
  public class oozie {
  
  public static void main(String[] args) {
      OozieClient wc = new OozieClient("http://host:11000/oozie");
  
      Properties conf = wc.createConfiguration();
  
      conf.setProperty(OozieClient.APP_PATH, "hdfs://cluster/user/apps/merge-psp-logs/merge-wf/workflow.xml");
      conf.setProperty("jobTracker", "jobtracker.bigdata.com:8021");
      conf.setProperty("nameNode", "hdfs://namenode.bigdata.com:8020");
      conf.setProperty("queueName", "jobtracker.bigdata.com:8021");
      conf.setProperty("appsRoot", "hdfs://namenode.bigdata.com:8020/user/workspace/apps");
      conf.setProperty("appLibLoc", "hdfs://namenode.bigdata.com:8020/user/workspace/lib");
      conf.setProperty("rawlogsLoc", "hdfs://namenode.bigdata.com:8020/user/workspace/");
      conf.setProperty("mergedlogsLoc", "jobtracker.bigdata.com:8021");
      try {
          String jobId = wc.run(conf);
          System.out.println("Workflow job submitted");
  
          while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) {
              System.out.println("Workflow job running ...");
              Thread.sleep(10 * 1000);
          }
          System.out.println("Workflow job completed ...");
          System.out.println(wc.getJobInfo(jobId));
      } catch (Exception r) {
          System.out.println("Errors");
      }
  }
  }
  </code></pre>
  
  <p>Though i am able to launch the job using command line</p>