title: Selenium WebDriver Java code doesn't execute on eclipse: Could not find the main class
body: <p>I have installed both jdk6 (jdk1.6.0_26) and jdk7 (jdk1.7.0_25). I have two following java classes:</p>
  
  <p>1st java file:</p>
  
  <pre><code>package code.google.com.p.selenium;
  import org.openqa.selenium.WebElement;
  public class GoogleSearchPage {
      // Here's the element
      private WebElement q;
  
      public void searchFor(String text) {
          // And here we use it. Note that it looks like we've
          // not properly instantiated it yet....
          q.sendKeys(text);
          q.submit();
      }
  }
  </code></pre>
  
  <p>2nd java file:</p>
  
  <pre><code>package code.google.com.p.selenium;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.htmlunit.HtmlUnitDriver;
  import org.openqa.selenium.support.PageFactory;
  
  public class UsingGoogleSearchPage {
      public static void main(String[] args) {
          // Create a new instance of a driver
          WebDriver driver = new HtmlUnitDriver();
  
          // Navigate to the right place
          driver.get("http://www.google.com/");
  
          // Create a new instance of the search page class
          // and initialise any WebElement fields in it.
          GoogleSearchPage page = PageFactory.initElements(driver, GoogleSearchPage.class);
  
          // And now do the search.
          page.searchFor("Cheese");
      }
  }
  </code></pre>
  
  <p>I am using Eclipse Indigo. In eclipse, I did the following steps:</p>
  
  <ol>
  <li>Right click on UsingGoogleSearchPage.java</li>
  <li>Click Run As->Java Application</li>
  </ol>
  
  <p>The program was not executed. An error was occurred (Please see the image).
  <img src="https://i.stack.imgur.com/QAYje.png" alt="enter image description here"></p>