title: Running Cucumber project using Main.run from another main method
body: <p>I am new to Cucumber and trying to solve simple issue:</p>
  
  <p>I have created a Java Project and referred all the cucumber related jars to the build-path of this project (called it "CukeTest4") and below is the structure showing the java file and feature file. When I run this feature file as Cucumber feature in Eclipse, it runs fine.</p>
  
  <p><a href="https://i.stack.imgur.com/G7ayX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/G7ayX.png" alt="enter image description here"></a> </p>
  
  <p>Now, I would like to run this from another main method. I created another Java Project, Added a Class with main method with code below which is in default package.</p>
  
  <pre><code>import cucumber.api.cli.Main;
  
  public class UseCukeFromMain {
      public static void main(String[] args) throws Throwable 
      {
          Main.main(new String[]{"-g", "C:/work/workspaces/neon2_wks_new1/Cuketest4/src/com/cuke", "C:/work/workspaces/neon2_wks_new1/Cuketest4/src/com/cuke/cukefeature.feature"});
      }
  }
  </code></pre>
  
  <p>I have provided implementation for the method in the java file as it works fine from Eclipse but shows the message below to implement the method</p>
  
  <pre><code>[33mU[0m
  
  1 Scenarios ([33m1 undefined[0m)
  1 Steps ([33m1 undefined[0m)
  0m0.000s
  
  
  You can implement missing steps with the snippets below:
  
  @Given("^I want to write a step with precondition$")
  public void i_want_to_write_a_step_with_precondition() throws Throwable {
  // Write code here that turns the phrase above into concrete actions
  throw new PendingException();
  }
  </code></pre>
  
  <p>I have tried a lot of combination for <strong>-g option</strong>, but the message is same.</p>
  
  <h2>EDIT2</h2>
  
  <p>From the comments below, adding the package to glue when the other project is in classpath, works fine.</p>
  
  <pre><code>Main.main(new String[]{"-g", "com.cuke", "C:/work/workspaces/neon2_wks_new1/Cuketest4/src/com/cuke/cukefeature.feature"};
  </code></pre>
  
  <p>But, Another issue:</p>
  
  <p>I have some old projects that I need to integrate with cucumber. All the .class and .java are present in the folder(NO src or bin directory): 
      C:\work\RFT_WS2\Cuketest3 
  , I have this directory in the Classpath. I have tried following option but unable to understand the issue: </p>
  
  <pre><code>-g "" path/to/feature //(NOT WORKING)
  -g "classpath:" path/to/feature //(NOT WORKING)  
  -g "Cuketest3" // Added "C:\work\RFT_WS2" in classpath (NOT WORKING) 
  </code></pre>
  
  <p>Now if I add the .java file to a package say "steps" and have "C:\work\RFT_WS2\Cuketest3" in classpath, option looks like</p>
  
  <pre><code>-g "steps" path/to/feature //(WORKING)
  </code></pre>
  
  <p>My question is that how to get it to find the methods implementation for a default package.</p>
  
  <p>Also how do add multiple glue option, for example</p>
  
  <p><strong>Not Working cases I tried</strong></p>
  
  <pre><code>Main.main(new String[]{"-g", "com.cuke,com.cuke1", "C:/work/workspaces/neon2_wks_new1/Cuketest4/src/com/cuke/cukefeature.feature"};
  
  Main.main(new String[]{"-g", "com.cuke", "com.cuke1", "C:/work/workspaces/neon2_wks_new1/Cuketest4/src/com/cuke/cukefeature.feature"};
  </code></pre>
  
  <p>Thanks.</p>