Unable to run TestNG test case in Eclipse with ChromeDriver
<p>I have written below code to open a site in chrome browser and verify its title. but when using <code>System.setProperty()</code> to set the <code>ChromeDriver</code> Path, it gives me syntax error and when I commented the line I get:  </p>

<pre><code>java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property..
</code></pre>

<p>My Code :</p>

<pre><code>    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.testng.Assert;
    import org.testng.annotations.Test;

   public class FirsttestNGFile {
    String BaseURL = "http://newtours.demoaut.com/";
    System.setProperty("webdriver.chrome.driver", "E:\\Automation Jars\\chromedriver_win32\\chromedriver.exe"); -- If I comment this line, I get Illegal state Exception for chromedriver path; if not commented , I get syntax error
    WebDriver driver = new ChromeDriver();  

    @Test
    public void verifyHomePageTitle() {     
    driver.get(BaseURL);
    String ExpectedTitle = "Welcome: Mercury Tours";
    String ActualTitle = driver.getTitle();
    Assert.assertEquals(ExpectedTitle, ActualTitle);
    driver.quit();          
    }
  }  
</code></pre>