I am trying to export my project as a runnable jar and run it without driver.exe files being present. I tried incorporating them with below code to make it independent but still unable to run the jar file without driver files being presenting in the same folder.


String currentDir=System.getProperty("user.dir");

System.setProperty("webdriver.chrome.driver", currentDir+File.separator+"chromedriver.exe");

1 Answer 1


You can use WebDriverManager for this purpose:

You can download the dependency by Gradle:

dependencies {

Then on the code, you just need to setup the driver and create the driver objects:

WebDriver driver = new ChromeDriver();

You can find details about driver version here.

  • Thank you so much. Worked like a charm!!! :)
    – Venky
    Commented Jun 24, 2019 at 4:47
  • Most welcome. Could you mark the answer as accepted? Commented Jun 24, 2019 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.