title: The path to the driver executable must be set by the webdriver.chrome.driver; IllegalStateException
body: <p>I have 2 packages. In one package I have declared the <code>launchBrowser()</code> method which looks like this:</p>
  
  <pre><code>package BaseCode;
  import org.openqa.selenium.WebDriver; 
  import org.openqa.selenium.chrome.ChromeDriver;
  
  public class TestBase {
  
      public static WebDriver driver = null;
  
          public void launchBrowser(String baseUrl) throws Exception{
              try {
                      System.out.println("Launching the Chrome Browser");
                      String driverpath = "E:\\Learning\\Selenium\\Drivers\\ChromeDriver\\chromedriver.exe";
                      System.setProperty("webdriver.chrome.driver",driverpath);
                      driver = new ChromeDriver();
                      driver.manage().window().maximize();
                      System.out.println("Opening URL: " + baseUrl);
                      driver.get(baseUrl);
          }catch(Exception E) {
              System.out.println(E.getMessage() +"\n" + E.getStackTrace());
              }
          }
  }
  </code></pre>
  
  <p>The second class where I am calling the above <code>launchBrowser()</code> method is this:</p>
  
  <pre><code>package pack_one;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import BaseCode.TestBase;
  
  public class MultipleiFrames {
  
      public static TestBase B = new TestBase();
  
      public static void main(String[] args) {
  
          WebDriver driver = new ChromeDriver();
          String url = "http://demo.guru99.com/selenium/guru99home/";
          try {
              B.launchBrowser(url);
          } catch (Exception e) {
              e.printStackTrace();
          }
  }
  </code></pre>
  
  <p>When running the code I am getting <strong>Exception</strong> in thread "main":</p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: The path to the driver executable
    must be set by the webdriver.chrome.driver system property</p>
  </blockquote>
  
  <p>Please help me....</p>