Resolve java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver error

  I started learning Selenium, installed all the required below items as per the norms:

1. JAVA
2. Eclipse
3. Chrome Driver
4. JAR files
5. Selenium - server

Then, I created my 1st script as below:




And got the below error :

Error: Unable to initialize main class Selenium.MyFirstScript
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver

Solution:

1. Remove all JAR files from Build Path > Module path > Apply
2. Add all JAR files to Build Path > Class path > apply & save
3. Check your chrome version(browser version) and accordingly downloaded chrome driver/respective browser driver
4. Run the script > SUCCESS !


Comments