I think this is because you are using a wrong version of firefox driver
try below :
public WebDriver driver;system.setproperty("webdriver.gecko.driver","path to your firefoxdriver");driver = new FierfoxDriver();